@pulumi/slack
Version:
A Pulumi package for managing Slack workspaces.
195 lines • 8.34 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! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Conversation = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("./utilities"));
/**
* Manages a Slack channel
*
* ## Required scopes
*
* This resource requires the following scopes:
*
* If using `bot` tokens:
*
* - [channels:read](https://api.slack.com/scopes/channels:read)
* (public channels)
* - [channels:manage](https://api.slack.com/scopes/channels:manage)
* (public channels)
* - [channels:join](https://api.slack.com/scopes/channels:join)
* (adopting existing public channels)
* - [groups:read](https://api.slack.com/scopes/groups:read)
* (private channels)
* - [groups:write](https://api.slack.com/scopes/groups:write)
* (private channels)
*
* If using `user` tokens:
*
* - [channels:read](https://api.slack.com/scopes/channels:read) (public channels)
* - [channels:write](https://api.slack.com/scopes/channels:manage) (public channels)
* - [groups:read](https://api.slack.com/scopes/groups:read) (private channels)
* - [groups:write](https://api.slack.com/scopes/groups:write) (private channels)
*
* The Slack API methods used by the resource are:
*
* - [conversations.create](https://api.slack.com/methods/conversations.create)
* - [conversations.join](https://api.slack.com/methods/conversations.join)
* - [conversations.setTopic](https://api.slack.com/methods/conversations.setTopic)
* - [conversations.setPurpose](https://api.slack.com/methods/conversations.setPurpose)
* - [conversations.info](https://api.slack.com/methods/conversations.info)
* - [conversations.members](https://api.slack.com/methods/conversations.members)
* - [conversations.kick](https://api.slack.com/methods/conversations.kick)
* - [conversations.invite](https://api.slack.com/methods/conversations.invite)
* - [conversations.rename](https://api.slack.com/methods/conversations.rename)
* - [conversations.archive](https://api.slack.com/methods/conversations.archive)
* - [conversations.unarchive](https://api.slack.com/methods/conversations.unarchive)
*
* 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 test = new slack.Conversation("test", {
* name: "my-channel",
* topic: "The topic for my channel",
* permanentMembers: [],
* isPrivate: true,
* });
* ```
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as slack from "@pulumi/slack";
*
* const nonadmin = new slack.Conversation("nonadmin", {
* name: "my-channel01",
* topic: "The channel won't be archived on destroy",
* permanentMembers: [],
* isPrivate: true,
* actionOnDestroy: "none",
* });
* ```
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as slack from "@pulumi/slack";
*
* const adopted = new slack.Conversation("adopted", {
* name: "my-channel02",
* topic: "Adopt existing, don't kick members",
* permanentMembers: [],
* adoptExistingChannel: true,
* actionOnUpdatePermanentMembers: "none",
* });
* ```
*
* ## Import
*
* `slack.Conversation` can be imported using the ID of the conversation/channel, e.g.
*
* ```sh
* $ pulumi import slack:index/conversation:Conversation my_conversation C023X7QTFHQ
* ```
*/
class Conversation extends pulumi.CustomResource {
/**
* Get an existing Conversation 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 Conversation(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'slack:index/conversation:Conversation';
/**
* Returns true if the given object is an instance of Conversation. 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'] === Conversation.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["actionOnDestroy"] = state?.actionOnDestroy;
resourceInputs["actionOnUpdatePermanentMembers"] = state?.actionOnUpdatePermanentMembers;
resourceInputs["adoptExistingChannel"] = state?.adoptExistingChannel;
resourceInputs["created"] = state?.created;
resourceInputs["creator"] = state?.creator;
resourceInputs["isArchived"] = state?.isArchived;
resourceInputs["isExtShared"] = state?.isExtShared;
resourceInputs["isGeneral"] = state?.isGeneral;
resourceInputs["isOrgShared"] = state?.isOrgShared;
resourceInputs["isPrivate"] = state?.isPrivate;
resourceInputs["isShared"] = state?.isShared;
resourceInputs["name"] = state?.name;
resourceInputs["permanentMembers"] = state?.permanentMembers;
resourceInputs["purpose"] = state?.purpose;
resourceInputs["topic"] = state?.topic;
}
else {
const args = argsOrState;
if (args?.isPrivate === undefined && !opts.urn) {
throw new Error("Missing required property 'isPrivate'");
}
resourceInputs["actionOnDestroy"] = args?.actionOnDestroy;
resourceInputs["actionOnUpdatePermanentMembers"] = args?.actionOnUpdatePermanentMembers;
resourceInputs["adoptExistingChannel"] = args?.adoptExistingChannel;
resourceInputs["isArchived"] = args?.isArchived;
resourceInputs["isPrivate"] = args?.isPrivate;
resourceInputs["name"] = args?.name;
resourceInputs["permanentMembers"] = args?.permanentMembers;
resourceInputs["purpose"] = args?.purpose;
resourceInputs["topic"] = args?.topic;
resourceInputs["created"] = undefined /*out*/;
resourceInputs["creator"] = undefined /*out*/;
resourceInputs["isExtShared"] = undefined /*out*/;
resourceInputs["isGeneral"] = undefined /*out*/;
resourceInputs["isOrgShared"] = undefined /*out*/;
resourceInputs["isShared"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Conversation.__pulumiType, name, resourceInputs, opts);
}
}
exports.Conversation = Conversation;
//# sourceMappingURL=conversation.js.map