1. Packages
  2. Slack
  3. API Docs
  4. getUser
Slack v0.4.4 published on Thursday, Mar 21, 2024 by Pulumi

slack.getUser

Explore with Pulumi AI

slack logo
Slack v0.4.4 published on Thursday, Mar 21, 2024 by Pulumi

    Use this data source to get information about a user for use in other resources.

    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.getUser({
        name: "my-user",
    });
    const byEmail = slack.getUser({
        email: "my-user@example.com",
    });
    
    import pulumi
    import pulumi_slack as slack
    
    by_name = slack.get_user(name="my-user")
    by_email = slack.get_user(email="my-user@example.com")
    
    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.GetUser(ctx, &slack.GetUserArgs{
    			Name: pulumi.StringRef("my-user"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = slack.GetUser(ctx, &slack.GetUserArgs{
    			Email: pulumi.StringRef("my-user@example.com"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Slack = Pulumi.Slack;
    
    return await Deployment.RunAsync(() => 
    {
        var byName = Slack.GetUser.Invoke(new()
        {
            Name = "my-user",
        });
    
        var byEmail = Slack.GetUser.Invoke(new()
        {
            Email = "my-user@example.com",
        });
    
    });
    
    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.GetUserArgs;
    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.getUser(GetUserArgs.builder()
                .name("my-user")
                .build());
    
            final var byEmail = SlackFunctions.getUser(GetUserArgs.builder()
                .email("my-user@example.com")
                .build());
    
        }
    }
    
    variables:
      byName:
        fn::invoke:
          Function: slack:getUser
          Arguments:
            name: my-user
      byEmail:
        fn::invoke:
          Function: slack:getUser
          Arguments:
            email: my-user@example.com
    

    Using getUser

    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 getUser(args: GetUserArgs, opts?: InvokeOptions): Promise<GetUserResult>
    function getUserOutput(args: GetUserOutputArgs, opts?: InvokeOptions): Output<GetUserResult>
    def get_user(email: Optional[str] = None,
                 name: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetUserResult
    def get_user_output(email: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetUserResult]
    func GetUser(ctx *Context, args *GetUserArgs, opts ...InvokeOption) (*GetUserResult, error)
    func GetUserOutput(ctx *Context, args *GetUserOutputArgs, opts ...InvokeOption) GetUserResultOutput

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

    public static class GetUser 
    {
        public static Task<GetUserResult> InvokeAsync(GetUserArgs args, InvokeOptions? opts = null)
        public static Output<GetUserResult> Invoke(GetUserInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetUserResult> getUser(GetUserArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: slack:index/getUser:getUser
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Email string

    The email of the user

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

    Name string
    The name of the user
    Email string

    The email of the user

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

    Name string
    The name of the user
    email String

    The email of the user

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

    name String
    The name of the user
    email string

    The email of the user

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

    name string
    The name of the user
    email str

    The email of the user

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

    name str
    The name of the user
    email String

    The email of the user

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

    name String
    The name of the user

    getUser Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Email string
    Name string
    Id string
    The provider-assigned unique ID for this managed resource.
    Email string
    Name string
    id String
    The provider-assigned unique ID for this managed resource.
    email String
    name String
    id string
    The provider-assigned unique ID for this managed resource.
    email string
    name string
    id str
    The provider-assigned unique ID for this managed resource.
    email str
    name str
    id String
    The provider-assigned unique ID for this managed resource.
    email String
    name String

    Package Details

    Repository
    slack pulumi/pulumi-slack
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the slack Terraform Provider.
    slack logo
    Slack v0.4.4 published on Thursday, Mar 21, 2024 by Pulumi