PagerDuty v4.17.0 published on Wednesday, Nov 20, 2024 by Pulumi
pagerduty.getUser
Explore with Pulumi AI
Use this data source to get information about a specific user that you can use for other PagerDuty resources.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as pagerduty from "@pulumi/pagerduty";
const me = pagerduty.getUser({
email: "me@example.com",
});
const foo = new pagerduty.EscalationPolicy("foo", {
name: "Engineering Escalation Policy",
numLoops: 2,
rules: [{
escalationDelayInMinutes: 10,
targets: [{
type: "user_reference",
id: me.then(me => me.id),
}],
}],
});
import pulumi
import pulumi_pagerduty as pagerduty
me = pagerduty.get_user(email="me@example.com")
foo = pagerduty.EscalationPolicy("foo",
name="Engineering Escalation Policy",
num_loops=2,
rules=[{
"escalation_delay_in_minutes": 10,
"targets": [{
"type": "user_reference",
"id": me.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 {
me, err := pagerduty.LookupUser(ctx, &pagerduty.LookupUserArgs{
Email: "me@example.com",
}, nil)
if err != nil {
return err
}
_, err = pagerduty.NewEscalationPolicy(ctx, "foo", &pagerduty.EscalationPolicyArgs{
Name: pulumi.String("Engineering Escalation Policy"),
NumLoops: pulumi.Int(2),
Rules: pagerduty.EscalationPolicyRuleArray{
&pagerduty.EscalationPolicyRuleArgs{
EscalationDelayInMinutes: pulumi.Int(10),
Targets: pagerduty.EscalationPolicyRuleTargetArray{
&pagerduty.EscalationPolicyRuleTargetArgs{
Type: pulumi.String("user_reference"),
Id: pulumi.String(me.Id),
},
},
},
},
})
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 me = Pagerduty.GetUser.Invoke(new()
{
Email = "me@example.com",
});
var foo = new Pagerduty.EscalationPolicy("foo", new()
{
Name = "Engineering Escalation Policy",
NumLoops = 2,
Rules = new[]
{
new Pagerduty.Inputs.EscalationPolicyRuleArgs
{
EscalationDelayInMinutes = 10,
Targets = new[]
{
new Pagerduty.Inputs.EscalationPolicyRuleTargetArgs
{
Type = "user_reference",
Id = me.Apply(getUserResult => getUserResult.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.GetUserArgs;
import com.pulumi.pagerduty.EscalationPolicy;
import com.pulumi.pagerduty.EscalationPolicyArgs;
import com.pulumi.pagerduty.inputs.EscalationPolicyRuleArgs;
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 me = PagerdutyFunctions.getUser(GetUserArgs.builder()
.email("me@example.com")
.build());
var foo = new EscalationPolicy("foo", EscalationPolicyArgs.builder()
.name("Engineering Escalation Policy")
.numLoops(2)
.rules(EscalationPolicyRuleArgs.builder()
.escalationDelayInMinutes(10)
.targets(EscalationPolicyRuleTargetArgs.builder()
.type("user_reference")
.id(me.applyValue(getUserResult -> getUserResult.id()))
.build())
.build())
.build());
}
}
resources:
foo:
type: pagerduty:EscalationPolicy
properties:
name: Engineering Escalation Policy
numLoops: 2
rules:
- escalationDelayInMinutes: 10
targets:
- type: user_reference
id: ${me.id}
variables:
me:
fn::invoke:
Function: pagerduty:getUser
Arguments:
email: me@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,
opts: Optional[InvokeOptions] = None) -> GetUserResult
def get_user_output(email: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetUserResult]
func LookupUser(ctx *Context, args *LookupUserArgs, opts ...InvokeOption) (*LookupUserResult, error)
func LookupUserOutput(ctx *Context, args *LookupUserOutputArgs, opts ...InvokeOption) LookupUserResultOutput
> Note: This function is named LookupUser
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: pagerduty:index/getUser:getUser
arguments:
# arguments dictionary
The following arguments are supported:
- Email string
- The email to use to find a user in the PagerDuty API.
- Email string
- The email to use to find a user in the PagerDuty API.
- email String
- The email to use to find a user in the PagerDuty API.
- email string
- The email to use to find a user in the PagerDuty API.
- email str
- The email to use to find a user in the PagerDuty API.
- email String
- The email to use to find a user in the PagerDuty API.
getUser Result
The following output properties are available:
- Description string
- The human-friendly description of the found user.
- Email string
- Id string
- The provider-assigned unique ID for this managed resource.
- 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.
- Description string
- The human-friendly description of the found user.
- Email string
- Id string
- The provider-assigned unique ID for this managed resource.
- 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.
- description String
- The human-friendly description of the found user.
- email String
- id String
- The provider-assigned unique ID for this managed resource.
- 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.
- description string
- The human-friendly description of the found user.
- email string
- id string
- The provider-assigned unique ID for this managed resource.
- 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.
- description str
- The human-friendly description of the found user.
- email str
- id str
- The provider-assigned unique ID for this managed resource.
- 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.
- description String
- The human-friendly description of the found user.
- email String
- id String
- The provider-assigned unique ID for this managed resource.
- 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.
Package Details
- Repository
- PagerDuty pulumi/pulumi-pagerduty
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
pagerduty
Terraform Provider.