dynatrace logo
Dynatrace v0.1.0, May 24 23

dynatrace.getEntity

Explore with Pulumi AI

The entity data source allows the entity ID to be retrieved by its name and type.

  • name (String) Display name of the entity
  • type (String) Type of the entity, e.g. SERVICE. All available entity types can be retrieved with /api/v2/entityTypes.

If multiple services match the given criteria, the first result will be retrieved.

Example Usage

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Dynatrace = Pulumi.Dynatrace;

return await Deployment.RunAsync(() => 
{
    var test = Dynatrace.GetEntity.Invoke(new()
    {
        Type = "SERVICE",
        Name = "BookingService",
    });

    return new Dictionary<string, object?>
    {
        ["id"] = test.Apply(getEntityResult => getEntityResult.Id),
    };
});
package main

import (
	"github.com/pulumi/pulumi-dynatrace/sdk/go/dynatrace"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		test, err := dynatrace.GetEntity(ctx, &dynatrace.GetEntityArgs{
			Type: "SERVICE",
			Name: "BookingService",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("id", test.Id)
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.dynatrace.DynatraceFunctions;
import com.pulumi.dynatrace.inputs.GetEntityArgs;
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 test = DynatraceFunctions.getEntity(GetEntityArgs.builder()
            .type("SERVICE")
            .name("BookingService")
            .build());

        ctx.export("id", test.applyValue(getEntityResult -> getEntityResult.id()));
    }
}
import pulumi
import pulumi_dynatrace as dynatrace

test = dynatrace.get_entity(type="SERVICE",
    name="BookingService")
pulumi.export("id", test.id)
import * as pulumi from "@pulumi/pulumi";
import * as dynatrace from "@pulumi/dynatrace";

const test = dynatrace.getEntity({
    type: "SERVICE",
    name: "BookingService",
});
export const id = test.then(test => test.id);
variables:
  test:
    fn::invoke:
      Function: dynatrace:getEntity
      Arguments:
        type: SERVICE
        name: BookingService
outputs:
  id: ${test.id}

Using getEntity

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 getEntity(args: GetEntityArgs, opts?: InvokeOptions): Promise<GetEntityResult>
function getEntityOutput(args: GetEntityOutputArgs, opts?: InvokeOptions): Output<GetEntityResult>
def get_entity(name: Optional[str] = None,
               type: Optional[str] = None,
               opts: Optional[InvokeOptions] = None) -> GetEntityResult
def get_entity_output(name: Optional[pulumi.Input[str]] = None,
               type: Optional[pulumi.Input[str]] = None,
               opts: Optional[InvokeOptions] = None) -> Output[GetEntityResult]
func GetEntity(ctx *Context, args *GetEntityArgs, opts ...InvokeOption) (*GetEntityResult, error)
func GetEntityOutput(ctx *Context, args *GetEntityOutputArgs, opts ...InvokeOption) GetEntityResultOutput

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

public static class GetEntity 
{
    public static Task<GetEntityResult> InvokeAsync(GetEntityArgs args, InvokeOptions? opts = null)
    public static Output<GetEntityResult> Invoke(GetEntityInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetEntityResult> getEntity(GetEntityArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: dynatrace:index/getEntity:getEntity
  arguments:
    # arguments dictionary

The following arguments are supported:

Name string
Type string
Name string
Type string
name String
type String
name string
type string
name str
type str
name String
type String

getEntity Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Name string
Type string
Id string

The provider-assigned unique ID for this managed resource.

Name string
Type string
id String

The provider-assigned unique ID for this managed resource.

name String
type String
id string

The provider-assigned unique ID for this managed resource.

name string
type string
id str

The provider-assigned unique ID for this managed resource.

name str
type str
id String

The provider-assigned unique ID for this managed resource.

name String
type String

Package Details

Repository
dynatrace lbrlabs/pulumi-dynatrace
License
Apache-2.0
Notes

This Pulumi package is based on the dynatrace Terraform Provider.