UNPKG

@pulumi/slack

Version:

A Pulumi package for managing Slack workspaces.

124 lines 4.76 kB
"use strict"; // *** 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.Usergroup = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Manages a Slack User Group. * * ## Required scopes * * This resource requires the following scopes: * * - [usergroups:write](https://api.slack.com/scopes/usergroups:write) * - [usergroups:read](https://api.slack.com/scopes/usergroups:read) * * The Slack API methods used by the resource are: * * - [usergroups.create](https://api.slack.com/methods/usergroups.create) * - [usergroups.enable](https://api.slack.com/methods/usergroups.enable) * - [usergroups.disable](https://api.slack.com/methods/usergroups.disable) * - [usergroups.update](https://api.slack.com/methods/usergroups.update) * - [usergroups.list](https://api.slack.com/methods/usergroups.list) * - [usergroups.users.update](https://api.slack.com/methods/usergroups.users.update) * * If you get `missingScope` errors while using this resource check the scopes against * the documentation for the methods above. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as slack from "@pulumi/slack"; * * const myGroup = new slack.Usergroup("my_group", { * name: "TestGroup", * handle: "test", * description: "Test user group", * users: ["USER00"], * channels: ["CHANNEL00"], * }); * ``` * * Note that if a channel is removed from the `channels` list users are * **not** removed from the channel. In order to keep the users in the * groups and in the channel in sync set `permanentUsers` in the channel: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as slack from "@pulumi/slack"; * * const myGroup = new slack.Usergroup("my_group", { * name: "TestGroup", * handle: "test", * description: "Test user group", * users: ["USER00"], * }); * const test = new slack.Conversation("test", { * name: "my-channel", * topic: "The topic for my channel", * permanentMembers: myGroup.users, * isPrivate: true, * }); * ``` * * ## Import * * `slack_usergroup` can be imported using the ID of the group, e.g. * * ```sh * $ pulumi import slack:index/usergroup:Usergroup my_group S022GE79E9G * ``` */ class Usergroup extends pulumi.CustomResource { /** * Get an existing Usergroup 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 Usergroup(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Usergroup. 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'] === Usergroup.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["channels"] = state ? state.channels : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["handle"] = state ? state.handle : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["users"] = state ? state.users : undefined; } else { const args = argsOrState; resourceInputs["channels"] = args ? args.channels : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["handle"] = args ? args.handle : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["users"] = args ? args.users : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Usergroup.__pulumiType, name, resourceInputs, opts); } } exports.Usergroup = Usergroup; /** @internal */ Usergroup.__pulumiType = 'slack:index/usergroup:Usergroup'; //# sourceMappingURL=usergroup.js.map