1. Packages
  2. PagerDuty
  3. API Docs
  4. getUsers
PagerDuty v4.10.1 published on Wednesday, Mar 27, 2024 by Pulumi

pagerduty.getUsers

Explore with Pulumi AI

pagerduty logo
PagerDuty v4.10.1 published on Wednesday, Mar 27, 2024 by Pulumi

    Use this data source to get information about list of users that you can use for other PagerDuty resources, optionally filtering by team ids.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as pagerduty from "@pulumi/pagerduty";
    
    const devops = pagerduty.getTeam({
        name: "devops",
    });
    const me = pagerduty.getUser({
        email: "me@example.com",
    });
    const exampleWTeam = new pagerduty.User("exampleWTeam", {email: "user-with-team@example.com"});
    const example = new pagerduty.TeamMembership("example", {
        teamId: pagerduty_team.devops.id,
        userId: exampleWTeam.id,
    });
    const allUsers = pagerduty.getUsers({});
    const fromDevopsTeam = pagerduty.getUsers({
        teamIds: [pagerduty_team.devops.id],
    });
    
    import pulumi
    import pulumi_pagerduty as pagerduty
    
    devops = pagerduty.get_team(name="devops")
    me = pagerduty.get_user(email="me@example.com")
    example_w_team = pagerduty.User("exampleWTeam", email="user-with-team@example.com")
    example = pagerduty.TeamMembership("example",
        team_id=pagerduty_team["devops"]["id"],
        user_id=example_w_team.id)
    all_users = pagerduty.get_users()
    from_devops_team = pagerduty.get_users(team_ids=[pagerduty_team["devops"]["id"]])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-pagerduty/sdk/v4/go/pagerduty"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
    _, err := pagerduty.LookupTeam(ctx, &pagerduty.LookupTeamArgs{
    Name: "devops",
    }, nil);
    if err != nil {
    return err
    }
    _, err = pagerduty.LookupUser(ctx, &pagerduty.LookupUserArgs{
    Email: "me@example.com",
    }, nil);
    if err != nil {
    return err
    }
    exampleWTeam, err := pagerduty.NewUser(ctx, "exampleWTeam", &pagerduty.UserArgs{
    Email: pulumi.String("user-with-team@example.com"),
    })
    if err != nil {
    return err
    }
    _, err = pagerduty.NewTeamMembership(ctx, "example", &pagerduty.TeamMembershipArgs{
    TeamId: pulumi.Any(pagerduty_team.Devops.Id),
    UserId: exampleWTeam.ID(),
    })
    if err != nil {
    return err
    }
    _, err = pagerduty.GetUsers(ctx, nil, nil);
    if err != nil {
    return err
    }
    _, err = pagerduty.GetUsers(ctx, &pagerduty.GetUsersArgs{
    TeamIds: interface{}{
    pagerduty_team.Devops.Id,
    },
    }, nil);
    if err != nil {
    return err
    }
    return nil
    })
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Pagerduty = Pulumi.Pagerduty;
    
    return await Deployment.RunAsync(() => 
    {
        var devops = Pagerduty.GetTeam.Invoke(new()
        {
            Name = "devops",
        });
    
        var me = Pagerduty.GetUser.Invoke(new()
        {
            Email = "me@example.com",
        });
    
        var exampleWTeam = new Pagerduty.User("exampleWTeam", new()
        {
            Email = "user-with-team@example.com",
        });
    
        var example = new Pagerduty.TeamMembership("example", new()
        {
            TeamId = pagerduty_team.Devops.Id,
            UserId = exampleWTeam.Id,
        });
    
        var allUsers = Pagerduty.GetUsers.Invoke();
    
        var fromDevopsTeam = Pagerduty.GetUsers.Invoke(new()
        {
            TeamIds = new[]
            {
                pagerduty_team.Devops.Id,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.pagerduty.PagerdutyFunctions;
    import com.pulumi.pagerduty.inputs.GetTeamArgs;
    import com.pulumi.pagerduty.inputs.GetUserArgs;
    import com.pulumi.pagerduty.User;
    import com.pulumi.pagerduty.UserArgs;
    import com.pulumi.pagerduty.TeamMembership;
    import com.pulumi.pagerduty.TeamMembershipArgs;
    import com.pulumi.pagerduty.inputs.GetUsersArgs;
    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 devops = PagerdutyFunctions.getTeam(GetTeamArgs.builder()
                .name("devops")
                .build());
    
            final var me = PagerdutyFunctions.getUser(GetUserArgs.builder()
                .email("me@example.com")
                .build());
    
            var exampleWTeam = new User("exampleWTeam", UserArgs.builder()        
                .email("user-with-team@example.com")
                .build());
    
            var example = new TeamMembership("example", TeamMembershipArgs.builder()        
                .teamId(pagerduty_team.devops().id())
                .userId(exampleWTeam.id())
                .build());
    
            final var allUsers = PagerdutyFunctions.getUsers();
    
            final var fromDevopsTeam = PagerdutyFunctions.getUsers(GetUsersArgs.builder()
                .teamIds(pagerduty_team.devops().id())
                .build());
    
        }
    }
    
    resources:
      exampleWTeam:
        type: pagerduty:User
        properties:
          email: user-with-team@example.com
      example:
        type: pagerduty:TeamMembership
        properties:
          teamId: ${pagerduty_team.devops.id}
          userId: ${exampleWTeam.id}
    variables:
      devops:
        fn::invoke:
          Function: pagerduty:getTeam
          Arguments:
            name: devops
      me:
        fn::invoke:
          Function: pagerduty:getUser
          Arguments:
            email: me@example.com
      allUsers:
        fn::invoke:
          Function: pagerduty:getUsers
          Arguments: {}
      fromDevopsTeam:
        fn::invoke:
          Function: pagerduty:getUsers
          Arguments:
            teamIds:
              - ${pagerduty_team.devops.id}
    

    Using getUsers

    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 getUsers(args: GetUsersArgs, opts?: InvokeOptions): Promise<GetUsersResult>
    function getUsersOutput(args: GetUsersOutputArgs, opts?: InvokeOptions): Output<GetUsersResult>
    def get_users(team_ids: Optional[Sequence[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> GetUsersResult
    def get_users_output(team_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetUsersResult]
    func GetUsers(ctx *Context, args *GetUsersArgs, opts ...InvokeOption) (*GetUsersResult, error)
    func GetUsersOutput(ctx *Context, args *GetUsersOutputArgs, opts ...InvokeOption) GetUsersResultOutput

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

    public static class GetUsers 
    {
        public static Task<GetUsersResult> InvokeAsync(GetUsersArgs args, InvokeOptions? opts = null)
        public static Output<GetUsersResult> Invoke(GetUsersInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetUsersResult> getUsers(GetUsersArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: pagerduty:index/getUsers:getUsers
      arguments:
        # arguments dictionary

    The following arguments are supported:

    TeamIds List<string>
    List of team IDs. Only results related to these teams will be returned. Account must have the teams ability to use this parameter.
    TeamIds []string
    List of team IDs. Only results related to these teams will be returned. Account must have the teams ability to use this parameter.
    teamIds List<String>
    List of team IDs. Only results related to these teams will be returned. Account must have the teams ability to use this parameter.
    teamIds string[]
    List of team IDs. Only results related to these teams will be returned. Account must have the teams ability to use this parameter.
    team_ids Sequence[str]
    List of team IDs. Only results related to these teams will be returned. Account must have the teams ability to use this parameter.
    teamIds List<String>
    List of team IDs. Only results related to these teams will be returned. Account must have the teams ability to use this parameter.

    getUsers Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Users List<GetUsersUser>
    List of users queried.
    TeamIds List<string>
    Id string
    The provider-assigned unique ID for this managed resource.
    Users []GetUsersUser
    List of users queried.
    TeamIds []string
    id String
    The provider-assigned unique ID for this managed resource.
    users List<GetUsersUser>
    List of users queried.
    teamIds List<String>
    id string
    The provider-assigned unique ID for this managed resource.
    users GetUsersUser[]
    List of users queried.
    teamIds string[]
    id str
    The provider-assigned unique ID for this managed resource.
    users Sequence[GetUsersUser]
    List of users queried.
    team_ids Sequence[str]
    id String
    The provider-assigned unique ID for this managed resource.
    users List<Property Map>
    List of users queried.
    teamIds List<String>

    Supporting Types

    GetUsersUser

    Description string
    The human-friendly description of the found user.
    Email string
    The email of the found user.
    Id string
    The ID of the found user.
    JobTitle string
    The job title of the found user.
    Name string
    The short name of the found user.
    Role string
    The role of the found user.
    TimeZone string
    The timezone of the found user.
    Type string
    Description string
    The human-friendly description of the found user.
    Email string
    The email of the found user.
    Id string
    The ID of the found user.
    JobTitle string
    The job title of the found user.
    Name string
    The short name of the found user.
    Role string
    The role of the found user.
    TimeZone string
    The timezone of the found user.
    Type string
    description String
    The human-friendly description of the found user.
    email String
    The email of the found user.
    id String
    The ID of the found user.
    jobTitle String
    The job title of the found user.
    name String
    The short name of the found user.
    role String
    The role of the found user.
    timeZone String
    The timezone of the found user.
    type String
    description string
    The human-friendly description of the found user.
    email string
    The email of the found user.
    id string
    The ID of the found user.
    jobTitle string
    The job title of the found user.
    name string
    The short name of the found user.
    role string
    The role of the found user.
    timeZone string
    The timezone of the found user.
    type string
    description str
    The human-friendly description of the found user.
    email str
    The email of the found user.
    id str
    The ID of the found user.
    job_title str
    The job title of the found user.
    name str
    The short name of the found user.
    role str
    The role of the found user.
    time_zone str
    The timezone of the found user.
    type str
    description String
    The human-friendly description of the found user.
    email String
    The email of the found user.
    id String
    The ID of the found user.
    jobTitle String
    The job title of the found user.
    name String
    The short name of the found user.
    role String
    The role of the found user.
    timeZone String
    The timezone of the found user.
    type String

    Package Details

    Repository
    PagerDuty pulumi/pulumi-pagerduty
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the pagerduty Terraform Provider.
    pagerduty logo
    PagerDuty v4.10.1 published on Wednesday, Mar 27, 2024 by Pulumi