PagerDuty v4.17.0 published on Wednesday, Nov 20, 2024 by Pulumi
pagerduty.getTag
Explore with Pulumi AI
Use this data source to get information about a specific tag that you can use to assign to users, teams, and escalation_policies.
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.getTag({
label: "devops",
});
const foo = new pagerduty.TagAssignment("foo", {
tagId: devops.then(devops => devops.id),
entityId: me.then(me => me.id),
entityType: "users",
});
import pulumi
import pulumi_pagerduty as pagerduty
me = pagerduty.get_user(email="me@example.com")
devops = pagerduty.get_tag(label="devops")
foo = pagerduty.TagAssignment("foo",
tag_id=devops.id,
entity_id=me.id,
entity_type="users")
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.LookupTag(ctx, &pagerduty.LookupTagArgs{
Label: "devops",
}, nil)
if err != nil {
return err
}
_, err = pagerduty.NewTagAssignment(ctx, "foo", &pagerduty.TagAssignmentArgs{
TagId: pulumi.String(devops.Id),
EntityId: pulumi.String(me.Id),
EntityType: pulumi.String("users"),
})
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.GetTag.Invoke(new()
{
Label = "devops",
});
var foo = new Pagerduty.TagAssignment("foo", new()
{
TagId = devops.Apply(getTagResult => getTagResult.Id),
EntityId = me.Apply(getUserResult => getUserResult.Id),
EntityType = "users",
});
});
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.GetTagArgs;
import com.pulumi.pagerduty.TagAssignment;
import com.pulumi.pagerduty.TagAssignmentArgs;
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.getTag(GetTagArgs.builder()
.label("devops")
.build());
var foo = new TagAssignment("foo", TagAssignmentArgs.builder()
.tagId(devops.applyValue(getTagResult -> getTagResult.id()))
.entityId(me.applyValue(getUserResult -> getUserResult.id()))
.entityType("users")
.build());
}
}
resources:
foo:
type: pagerduty:TagAssignment
properties:
tagId: ${devops.id}
entityId: ${me.id}
entityType: users
variables:
me:
fn::invoke:
Function: pagerduty:getUser
Arguments:
email: me@example.com
devops:
fn::invoke:
Function: pagerduty:getTag
Arguments:
label: devops
Using getTag
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 getTag(args: GetTagArgs, opts?: InvokeOptions): Promise<GetTagResult>
function getTagOutput(args: GetTagOutputArgs, opts?: InvokeOptions): Output<GetTagResult>
def get_tag(label: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetTagResult
def get_tag_output(label: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetTagResult]
func LookupTag(ctx *Context, args *LookupTagArgs, opts ...InvokeOption) (*LookupTagResult, error)
func LookupTagOutput(ctx *Context, args *LookupTagOutputArgs, opts ...InvokeOption) LookupTagResultOutput
> Note: This function is named LookupTag
in the Go SDK.
public static class GetTag
{
public static Task<GetTagResult> InvokeAsync(GetTagArgs args, InvokeOptions? opts = null)
public static Output<GetTagResult> Invoke(GetTagInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetTagResult> getTag(GetTagArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: pagerduty:index/getTag:getTag
arguments:
# arguments dictionary
The following arguments are supported:
- Label string
- The label of the tag to find in the PagerDuty API.
- Label string
- The label of the tag to find in the PagerDuty API.
- label String
- The label of the tag to find in the PagerDuty API.
- label string
- The label of the tag to find in the PagerDuty API.
- label str
- The label of the tag to find in the PagerDuty API.
- label String
- The label of the tag to find in the PagerDuty API.
getTag Result
The following output properties are available:
Package Details
- Repository
- PagerDuty pulumi/pulumi-pagerduty
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
pagerduty
Terraform Provider.