1. Packages
  2. Dynatrace
  3. API Docs
  4. getEntity
Dynatrace v0.10.0 published on Friday, Jun 7, 2024 by Pulumiverse

dynatrace.getEntity

Explore with Pulumi AI

dynatrace logo
Dynatrace v0.10.0 published on Friday, Jun 7, 2024 by Pulumiverse

    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

    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);
    
    import pulumi
    import pulumi_dynatrace as dynatrace
    
    test = dynatrace.get_entity(type="SERVICE",
        name="BookingService")
    pulumi.export("id", test.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-dynatrace/sdk/go/dynatrace"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		test, err := dynatrace.GetEntity(ctx, &dynatrace.GetEntityArgs{
    			Type: pulumi.StringRef("SERVICE"),
    			Name: pulumi.StringRef("BookingService"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("id", test.Id)
    		return nil
    	})
    }
    
    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 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()));
        }
    }
    
    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(entity_selector: Optional[str] = None,
                   from_: Optional[str] = None,
                   name: Optional[str] = None,
                   to: Optional[str] = None,
                   type: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetEntityResult
    def get_entity_output(entity_selector: Optional[pulumi.Input[str]] = None,
                   from_: Optional[pulumi.Input[str]] = None,
                   name: Optional[pulumi.Input[str]] = None,
                   to: 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:

    EntitySelector string
    From string
    Name string
    To string
    Type string
    EntitySelector string
    From string
    Name string
    To string
    Type string
    entitySelector String
    from String
    name String
    to String
    type String
    entitySelector string
    from string
    name string
    to string
    type string
    entity_selector str
    from_ str
    name str
    to str
    type str
    entitySelector String
    from String
    name String
    to String
    type String

    getEntity Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Properties Dictionary<string, string>
    EntitySelector string
    From string
    Name string
    To string
    Type string
    Id string
    The provider-assigned unique ID for this managed resource.
    Properties map[string]string
    EntitySelector string
    From string
    Name string
    To string
    Type string
    id String
    The provider-assigned unique ID for this managed resource.
    properties Map<String,String>
    entitySelector String
    from String
    name String
    to String
    type String
    id string
    The provider-assigned unique ID for this managed resource.
    properties {[key: string]: string}
    entitySelector string
    from string
    name string
    to string
    type string
    id str
    The provider-assigned unique ID for this managed resource.
    properties Mapping[str, str]
    entity_selector str
    from_ str
    name str
    to str
    type str
    id String
    The provider-assigned unique ID for this managed resource.
    properties Map<String>
    entitySelector String
    from String
    name String
    to String
    type String

    Package Details

    Repository
    dynatrace pulumiverse/pulumi-dynatrace
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the dynatrace Terraform Provider.
    dynatrace logo
    Dynatrace v0.10.0 published on Friday, Jun 7, 2024 by Pulumiverse