PagerDuty v4.13.2 published on Thursday, Jun 27, 2024 by Pulumi
pagerduty.getUsers
Explore with Pulumi AI
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("example_w_team", {
name: "user-with-team",
email: "user-with-team@example.com",
});
const example = new pagerduty.TeamMembership("example", {
teamId: devopsPagerdutyTeam.id,
userId: exampleWTeam.id,
});
const allUsers = pagerduty.getUsers({});
const fromDevopsTeam = pagerduty.getUsers({
teamIds: [devopsPagerdutyTeam.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("example_w_team",
name="user-with-team",
email="user-with-team@example.com")
example = pagerduty.TeamMembership("example",
team_id=devops_pagerduty_team["id"],
user_id=example_w_team.id)
all_users = pagerduty.get_users()
from_devops_team = pagerduty.get_users(team_ids=[devops_pagerduty_team["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, "example_w_team", &pagerduty.UserArgs{
Name: pulumi.String("user-with-team"),
Email: pulumi.String("user-with-team@example.com"),
})
if err != nil {
return err
}
_, err = pagerduty.NewTeamMembership(ctx, "example", &pagerduty.TeamMembershipArgs{
TeamId: pulumi.Any(devopsPagerdutyTeam.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{}{
devopsPagerdutyTeam.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("example_w_team", new()
{
Name = "user-with-team",
Email = "user-with-team@example.com",
});
var example = new Pagerduty.TeamMembership("example", new()
{
TeamId = devopsPagerdutyTeam.Id,
UserId = exampleWTeam.Id,
});
var allUsers = Pagerduty.GetUsers.Invoke();
var fromDevopsTeam = Pagerduty.GetUsers.Invoke(new()
{
TeamIds = new[]
{
devopsPagerdutyTeam.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()
.name("user-with-team")
.email("user-with-team@example.com")
.build());
var example = new TeamMembership("example", TeamMembershipArgs.builder()
.teamId(devopsPagerdutyTeam.id())
.userId(exampleWTeam.id())
.build());
final var allUsers = PagerdutyFunctions.getUsers();
final var fromDevopsTeam = PagerdutyFunctions.getUsers(GetUsersArgs.builder()
.teamIds(devopsPagerdutyTeam.id())
.build());
}
}
resources:
exampleWTeam:
type: pagerduty:User
name: example_w_team
properties:
name: user-with-team
email: user-with-team@example.com
example:
type: pagerduty:TeamMembership
properties:
teamId: ${devopsPagerdutyTeam.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:
- ${devopsPagerdutyTeam.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:
- Team
Ids 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.
- Team
Ids []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 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.
- team
Ids 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.
- team
Ids 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<Get
Users User> - List of users queried.
- Team
Ids List<string>
- Id string
- The provider-assigned unique ID for this managed resource.
- Users
[]Get
Users User - List of users queried.
- Team
Ids []string
- id String
- The provider-assigned unique ID for this managed resource.
- users
List<Get
Users User> - List of users queried.
- team
Ids List<String>
- id string
- The provider-assigned unique ID for this managed resource.
- users
Get
Users User[] - List of users queried.
- team
Ids string[]
- id str
- The provider-assigned unique ID for this managed resource.
- users
Sequence[Get
Users User] - 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.
- team
Ids 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.
- Job
Title 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.
- Time
Zone 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.
- Job
Title 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.
- Time
Zone 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.
- job
Title 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.
- time
Zone 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.
- job
Title 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.
- time
Zone 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.
- job
Title 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.
- time
Zone 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.