1. Packages
  2. Slack Provider
  3. API Docs
  4. getUsergroup
Slack v0.4.11 published on Wednesday, Feb 12, 2025 by Pulumi

slack.getUsergroup

Explore with Pulumi AI

Slack v0.4.11 published on Wednesday, Feb 12, 2025 by Pulumi

Use this data source to get information about a usergroups for use in other resources. The data source returns enabled groups only.

Required scopes

This resource requires the following scopes:

The Slack API methods used by the resource are:

If you get missing_scope errors while using this resource check the scopes against the documentation for the methods above.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as slack from "@pulumi/slack";

const byName = slack.getUsergroup({
    name: "my-usergroup",
});
const byId = slack.getUsergroup({
    usergroupId: "USERGROUP00",
});
Copy
import pulumi
import pulumi_slack as slack

by_name = slack.get_usergroup(name="my-usergroup")
by_id = slack.get_usergroup(usergroup_id="USERGROUP00")
Copy
package main

import (
	"github.com/pulumi/pulumi-slack/sdk/go/slack"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := slack.LookupUsergroup(ctx, &slack.LookupUsergroupArgs{
			Name: pulumi.StringRef("my-usergroup"),
		}, nil)
		if err != nil {
			return err
		}
		_, err = slack.LookupUsergroup(ctx, &slack.LookupUsergroupArgs{
			UsergroupId: pulumi.StringRef("USERGROUP00"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Slack = Pulumi.Slack;

return await Deployment.RunAsync(() => 
{
    var byName = Slack.GetUsergroup.Invoke(new()
    {
        Name = "my-usergroup",
    });

    var byId = Slack.GetUsergroup.Invoke(new()
    {
        UsergroupId = "USERGROUP00",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.slack.SlackFunctions;
import com.pulumi.slack.inputs.GetUsergroupArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var byName = SlackFunctions.getUsergroup(GetUsergroupArgs.builder()
            .name("my-usergroup")
            .build());

        final var byId = SlackFunctions.getUsergroup(GetUsergroupArgs.builder()
            .usergroupId("USERGROUP00")
            .build());

    }
}
Copy
variables:
  byName:
    fn::invoke:
      function: slack:getUsergroup
      arguments:
        name: my-usergroup
  byId:
    fn::invoke:
      function: slack:getUsergroup
      arguments:
        usergroupId: USERGROUP00
Copy

Using getUsergroup

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getUsergroup(args: GetUsergroupArgs, opts?: InvokeOptions): Promise<GetUsergroupResult>
function getUsergroupOutput(args: GetUsergroupOutputArgs, opts?: InvokeOptions): Output<GetUsergroupResult>
Copy
def get_usergroup(name: Optional[str] = None,
                  usergroup_id: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetUsergroupResult
def get_usergroup_output(name: Optional[pulumi.Input[str]] = None,
                  usergroup_id: Optional[pulumi.Input[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetUsergroupResult]
Copy
func LookupUsergroup(ctx *Context, args *LookupUsergroupArgs, opts ...InvokeOption) (*LookupUsergroupResult, error)
func LookupUsergroupOutput(ctx *Context, args *LookupUsergroupOutputArgs, opts ...InvokeOption) LookupUsergroupResultOutput
Copy

> Note: This function is named LookupUsergroup in the Go SDK.

public static class GetUsergroup 
{
    public static Task<GetUsergroupResult> InvokeAsync(GetUsergroupArgs args, InvokeOptions? opts = null)
    public static Output<GetUsergroupResult> Invoke(GetUsergroupInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetUsergroupResult> getUsergroup(GetUsergroupArgs args, InvokeOptions options)
public static Output<GetUsergroupResult> getUsergroup(GetUsergroupArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: slack:index/getUsergroup:getUsergroup
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name string
The name of the usergroup
UsergroupId string

The id of the usergroup

The data source expects exactly one of these fields, you can't set both.

Name string
The name of the usergroup
UsergroupId string

The id of the usergroup

The data source expects exactly one of these fields, you can't set both.

name String
The name of the usergroup
usergroupId String

The id of the usergroup

The data source expects exactly one of these fields, you can't set both.

name string
The name of the usergroup
usergroupId string

The id of the usergroup

The data source expects exactly one of these fields, you can't set both.

name str
The name of the usergroup
usergroup_id str

The id of the usergroup

The data source expects exactly one of these fields, you can't set both.

name String
The name of the usergroup
usergroupId String

The id of the usergroup

The data source expects exactly one of these fields, you can't set both.

getUsergroup Result

The following output properties are available:

Channels List<string>
The channel IDs for which the User Group uses as a default.
Description string
The short description of the User Group.
Handle string
The mention handle.
Id string
The provider-assigned unique ID for this managed resource.
Users List<string>
The user IDs that represent the entire list of users for the User Group.
Name string
UsergroupId string
Channels []string
The channel IDs for which the User Group uses as a default.
Description string
The short description of the User Group.
Handle string
The mention handle.
Id string
The provider-assigned unique ID for this managed resource.
Users []string
The user IDs that represent the entire list of users for the User Group.
Name string
UsergroupId string
channels List<String>
The channel IDs for which the User Group uses as a default.
description String
The short description of the User Group.
handle String
The mention handle.
id String
The provider-assigned unique ID for this managed resource.
users List<String>
The user IDs that represent the entire list of users for the User Group.
name String
usergroupId String
channels string[]
The channel IDs for which the User Group uses as a default.
description string
The short description of the User Group.
handle string
The mention handle.
id string
The provider-assigned unique ID for this managed resource.
users string[]
The user IDs that represent the entire list of users for the User Group.
name string
usergroupId string
channels Sequence[str]
The channel IDs for which the User Group uses as a default.
description str
The short description of the User Group.
handle str
The mention handle.
id str
The provider-assigned unique ID for this managed resource.
users Sequence[str]
The user IDs that represent the entire list of users for the User Group.
name str
usergroup_id str
channels List<String>
The channel IDs for which the User Group uses as a default.
description String
The short description of the User Group.
handle String
The mention handle.
id String
The provider-assigned unique ID for this managed resource.
users List<String>
The user IDs that represent the entire list of users for the User Group.
name String
usergroupId String

Package Details

Repository
slack pulumi/pulumi-slack
License
Apache-2.0
Notes
This Pulumi package is based on the slack Terraform Provider.
Slack v0.4.11 published on Wednesday, Feb 12, 2025 by Pulumi