1. Packages
  2. PagerDuty
  3. API Docs
  4. getTeam
PagerDuty v4.13.2 published on Thursday, Jun 27, 2024 by Pulumi

pagerduty.getTeam

Explore with Pulumi AI

pagerduty logo
PagerDuty v4.13.2 published on Thursday, Jun 27, 2024 by Pulumi

    Use this data source to get information about a specific team 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 devops = pagerduty.getTeam({
        name: "devops",
    });
    const foo = new pagerduty.EscalationPolicy("foo", {
        name: "DevOps Escalation Policy",
        numLoops: 2,
        teams: devops.then(devops => devops.id),
        rules: [{
            escalationDelayInMinutes: 10,
            targets: [{
                type: "user",
                id: me.then(me => me.id),
            }],
        }],
    });
    
    import pulumi
    import pulumi_pagerduty as pagerduty
    
    me = pagerduty.get_user(email="me@example.com")
    devops = pagerduty.get_team(name="devops")
    foo = pagerduty.EscalationPolicy("foo",
        name="DevOps Escalation Policy",
        num_loops=2,
        teams=devops.id,
        rules=[pagerduty.EscalationPolicyRuleArgs(
            escalation_delay_in_minutes=10,
            targets=[pagerduty.EscalationPolicyRuleTargetArgs(
                type="user",
                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
    		}
    		devops, err := pagerduty.LookupTeam(ctx, &pagerduty.LookupTeamArgs{
    			Name: "devops",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = pagerduty.NewEscalationPolicy(ctx, "foo", &pagerduty.EscalationPolicyArgs{
    			Name:     pulumi.String("DevOps Escalation Policy"),
    			NumLoops: pulumi.Int(2),
    			Teams:    pulumi.String(devops.Id),
    			Rules: pagerduty.EscalationPolicyRuleArray{
    				&pagerduty.EscalationPolicyRuleArgs{
    					EscalationDelayInMinutes: pulumi.Int(10),
    					Targets: pagerduty.EscalationPolicyRuleTargetArray{
    						&pagerduty.EscalationPolicyRuleTargetArgs{
    							Type: pulumi.String("user"),
    							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 devops = Pagerduty.GetTeam.Invoke(new()
        {
            Name = "devops",
        });
    
        var foo = new Pagerduty.EscalationPolicy("foo", new()
        {
            Name = "DevOps Escalation Policy",
            NumLoops = 2,
            Teams = devops.Apply(getTeamResult => getTeamResult.Id),
            Rules = new[]
            {
                new Pagerduty.Inputs.EscalationPolicyRuleArgs
                {
                    EscalationDelayInMinutes = 10,
                    Targets = new[]
                    {
                        new Pagerduty.Inputs.EscalationPolicyRuleTargetArgs
                        {
                            Type = "user",
                            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.inputs.GetTeamArgs;
    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());
    
            final var devops = PagerdutyFunctions.getTeam(GetTeamArgs.builder()
                .name("devops")
                .build());
    
            var foo = new EscalationPolicy("foo", EscalationPolicyArgs.builder()
                .name("DevOps Escalation Policy")
                .numLoops(2)
                .teams(devops.applyValue(getTeamResult -> getTeamResult.id()))
                .rules(EscalationPolicyRuleArgs.builder()
                    .escalationDelayInMinutes(10)
                    .targets(EscalationPolicyRuleTargetArgs.builder()
                        .type("user")
                        .id(me.applyValue(getUserResult -> getUserResult.id()))
                        .build())
                    .build())
                .build());
    
        }
    }
    
    resources:
      foo:
        type: pagerduty:EscalationPolicy
        properties:
          name: DevOps Escalation Policy
          numLoops: 2
          teams: ${devops.id}
          rules:
            - escalationDelayInMinutes: 10
              targets:
                - type: user
                  id: ${me.id}
    variables:
      me:
        fn::invoke:
          Function: pagerduty:getUser
          Arguments:
            email: me@example.com
      devops:
        fn::invoke:
          Function: pagerduty:getTeam
          Arguments:
            name: devops
    

    Using getTeam

    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 getTeam(args: GetTeamArgs, opts?: InvokeOptions): Promise<GetTeamResult>
    function getTeamOutput(args: GetTeamOutputArgs, opts?: InvokeOptions): Output<GetTeamResult>
    def get_team(default_role: Optional[str] = None,
                 name: Optional[str] = None,
                 parent: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetTeamResult
    def get_team_output(default_role: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 parent: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetTeamResult]
    func LookupTeam(ctx *Context, args *LookupTeamArgs, opts ...InvokeOption) (*LookupTeamResult, error)
    func LookupTeamOutput(ctx *Context, args *LookupTeamOutputArgs, opts ...InvokeOption) LookupTeamResultOutput

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

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

    The following arguments are supported:

    Name string
    The name of the team to find in the PagerDuty API.
    DefaultRole string
    (Optional) The team is private if the value is "none", or public if it is "manager" (the default permissions for a non-member of the team are either "none", or their base role up until "manager").
    Parent string
    ID of the parent team. This is available to accounts with the Team Hierarchy feature enabled. Please contact your account manager for more information.
    Name string
    The name of the team to find in the PagerDuty API.
    DefaultRole string
    (Optional) The team is private if the value is "none", or public if it is "manager" (the default permissions for a non-member of the team are either "none", or their base role up until "manager").
    Parent string
    ID of the parent team. This is available to accounts with the Team Hierarchy feature enabled. Please contact your account manager for more information.
    name String
    The name of the team to find in the PagerDuty API.
    defaultRole String
    (Optional) The team is private if the value is "none", or public if it is "manager" (the default permissions for a non-member of the team are either "none", or their base role up until "manager").
    parent String
    ID of the parent team. This is available to accounts with the Team Hierarchy feature enabled. Please contact your account manager for more information.
    name string
    The name of the team to find in the PagerDuty API.
    defaultRole string
    (Optional) The team is private if the value is "none", or public if it is "manager" (the default permissions for a non-member of the team are either "none", or their base role up until "manager").
    parent string
    ID of the parent team. This is available to accounts with the Team Hierarchy feature enabled. Please contact your account manager for more information.
    name str
    The name of the team to find in the PagerDuty API.
    default_role str
    (Optional) The team is private if the value is "none", or public if it is "manager" (the default permissions for a non-member of the team are either "none", or their base role up until "manager").
    parent str
    ID of the parent team. This is available to accounts with the Team Hierarchy feature enabled. Please contact your account manager for more information.
    name String
    The name of the team to find in the PagerDuty API.
    defaultRole String
    (Optional) The team is private if the value is "none", or public if it is "manager" (the default permissions for a non-member of the team are either "none", or their base role up until "manager").
    parent String
    ID of the parent team. This is available to accounts with the Team Hierarchy feature enabled. Please contact your account manager for more information.

    getTeam Result

    The following output properties are available:

    Description string
    A description of the found team.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    The name of the found team.
    DefaultRole string
    (Optional) The team is private if the value is "none", or public if it is "manager" (the default permissions for a non-member of the team are either "none", or their base role up until "manager").
    Parent string
    ID of the parent team. This is available to accounts with the Team Hierarchy feature enabled. Please contact your account manager for more information.
    Description string
    A description of the found team.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    The name of the found team.
    DefaultRole string
    (Optional) The team is private if the value is "none", or public if it is "manager" (the default permissions for a non-member of the team are either "none", or their base role up until "manager").
    Parent string
    ID of the parent team. This is available to accounts with the Team Hierarchy feature enabled. Please contact your account manager for more information.
    description String
    A description of the found team.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    The name of the found team.
    defaultRole String
    (Optional) The team is private if the value is "none", or public if it is "manager" (the default permissions for a non-member of the team are either "none", or their base role up until "manager").
    parent String
    ID of the parent team. This is available to accounts with the Team Hierarchy feature enabled. Please contact your account manager for more information.
    description string
    A description of the found team.
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    The name of the found team.
    defaultRole string
    (Optional) The team is private if the value is "none", or public if it is "manager" (the default permissions for a non-member of the team are either "none", or their base role up until "manager").
    parent string
    ID of the parent team. This is available to accounts with the Team Hierarchy feature enabled. Please contact your account manager for more information.
    description str
    A description of the found team.
    id str
    The provider-assigned unique ID for this managed resource.
    name str
    The name of the found team.
    default_role str
    (Optional) The team is private if the value is "none", or public if it is "manager" (the default permissions for a non-member of the team are either "none", or their base role up until "manager").
    parent str
    ID of the parent team. This is available to accounts with the Team Hierarchy feature enabled. Please contact your account manager for more information.
    description String
    A description of the found team.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    The name of the found team.
    defaultRole String
    (Optional) The team is private if the value is "none", or public if it is "manager" (the default permissions for a non-member of the team are either "none", or their base role up until "manager").
    parent String
    ID of the parent team. This is available to accounts with the Team Hierarchy feature enabled. Please contact your account manager for more information.

    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.13.2 published on Thursday, Jun 27, 2024 by Pulumi