Dynatrace

v0.0.2 published on Tuesday, Nov 1, 2022 by Lbrlabs

getApplication

The application data source allows the application ID to be retrieved by its name and optionally tags / tag-value pairs.

  • name queries for all applications with the specified name
  • tags (optional) refers to the tags that need to be present for the application (inclusive)

Example Usage

using System.Collections.Generic;
using Pulumi;
using Dynatrace = Lbrlabs.PulumiPackage.Dynatrace;
using Dynatrace = Pulumi.Dynatrace;

return await Deployment.RunAsync(() => 
{
    var test = Dynatrace.GetApplication.Invoke(new()
    {
        Name = "Example",
        Tags = new[]
        {
            "TerraformKeyTest",
            "TerraformKeyValueTest=TestValue",
        },
    });

    var _name_ = new Dynatrace.ApplicationDetectionRule("#name#", new()
    {
        ApplicationIdentifier = test.Apply(getApplicationResult => getApplicationResult.Id),
        FilterConfig = new Dynatrace.Inputs.ApplicationDetectionRuleFilterConfigArgs
        {
            ApplicationMatchTarget = "DOMAIN",
            ApplicationMatchType = "MATCHES",
            Pattern = "www.google.com",
        },
    });

});
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.GetApplication(ctx, &GetApplicationArgs{
			Name: "Example",
			Tags: []string{
				"TerraformKeyTest",
				"TerraformKeyValueTest=TestValue",
			},
		}, nil)
		if err != nil {
			return err
		}
		_, err = dynatrace.NewApplicationDetectionRule(ctx, "#name#", &dynatrace.ApplicationDetectionRuleArgs{
			ApplicationIdentifier: pulumi.String(test.Id),
			FilterConfig: &ApplicationDetectionRuleFilterConfigArgs{
				ApplicationMatchTarget: pulumi.String("DOMAIN"),
				ApplicationMatchType:   pulumi.String("MATCHES"),
				Pattern:                pulumi.String("www.google.com"),
			},
		})
		if err != nil {
			return err
		}
		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.GetApplicationArgs;
import com.pulumi.dynatrace.ApplicationDetectionRule;
import com.pulumi.dynatrace.ApplicationDetectionRuleArgs;
import com.pulumi.dynatrace.inputs.ApplicationDetectionRuleFilterConfigArgs;
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.getApplication(GetApplicationArgs.builder()
            .name("Example")
            .tags(            
                "TerraformKeyTest",
                "TerraformKeyValueTest=TestValue")
            .build());

        var _name_ = new ApplicationDetectionRule("#name#", ApplicationDetectionRuleArgs.builder()        
            .applicationIdentifier(test.applyValue(getApplicationResult -> getApplicationResult.id()))
            .filterConfig(ApplicationDetectionRuleFilterConfigArgs.builder()
                .applicationMatchTarget("DOMAIN")
                .applicationMatchType("MATCHES")
                .pattern("www.google.com")
                .build())
            .build());

    }
}
import pulumi
import lbrlabs_pulumi_dynatrace as dynatrace
import pulumi_dynatrace as dynatrace

test = dynatrace.get_application(name="Example",
    tags=[
        "TerraformKeyTest",
        "TerraformKeyValueTest=TestValue",
    ])
_name_ = dynatrace.ApplicationDetectionRule("#name#",
    application_identifier=test.id,
    filter_config=dynatrace.ApplicationDetectionRuleFilterConfigArgs(
        application_match_target="DOMAIN",
        application_match_type="MATCHES",
        pattern="www.google.com",
    ))
import * as pulumi from "@pulumi/pulumi";
import * as dynatrace from "@lbrlabs/pulumi-dynatrace";
import * as dynatrace from "@pulumi/dynatrace";

const test = dynatrace.getApplication({
    name: "Example",
    tags: [
        "TerraformKeyTest",
        "TerraformKeyValueTest=TestValue",
    ],
});
const _name_ = new dynatrace.ApplicationDetectionRule("#name#", {
    applicationIdentifier: test.then(test => test.id),
    filterConfig: {
        applicationMatchTarget: "DOMAIN",
        applicationMatchType: "MATCHES",
        pattern: "www.google.com",
    },
});
resources:
  '#name#':
    type: dynatrace:ApplicationDetectionRule
    properties:
      applicationIdentifier: ${test.id}
      filterConfig:
        applicationMatchTarget: DOMAIN
        applicationMatchType: MATCHES
        pattern: www.google.com
variables:
  test:
    fn::invoke:
      Function: dynatrace:getApplication
      Arguments:
        name: Example
        tags:
          - TerraformKeyTest
          - TerraformKeyValueTest=TestValue

Using getApplication

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 getApplication(args: GetApplicationArgs, opts?: InvokeOptions): Promise<GetApplicationResult>
function getApplicationOutput(args: GetApplicationOutputArgs, opts?: InvokeOptions): Output<GetApplicationResult>
def get_application(name: Optional[str] = None,
                    tags: Optional[Sequence[str]] = None,
                    opts: Optional[InvokeOptions] = None) -> GetApplicationResult
def get_application_output(name: Optional[pulumi.Input[str]] = None,
                    tags: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                    opts: Optional[InvokeOptions] = None) -> Output[GetApplicationResult]
func GetApplication(ctx *Context, args *GetApplicationArgs, opts ...InvokeOption) (*GetApplicationResult, error)
func GetApplicationOutput(ctx *Context, args *GetApplicationOutputArgs, opts ...InvokeOption) GetApplicationResultOutput

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

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

The following arguments are supported:

Name string
Tags List<string>

Required tags of the application to find

Name string
Tags []string

Required tags of the application to find

name String
tags List<String>

Required tags of the application to find

name string
tags string[]

Required tags of the application to find

name str
tags Sequence[str]

Required tags of the application to find

name String
tags List<String>

Required tags of the application to find

getApplication Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Name string
Tags List<string>

Required tags of the application to find

Id string

The provider-assigned unique ID for this managed resource.

Name string
Tags []string

Required tags of the application to find

id String

The provider-assigned unique ID for this managed resource.

name String
tags List<String>

Required tags of the application to find

id string

The provider-assigned unique ID for this managed resource.

name string
tags string[]

Required tags of the application to find

id str

The provider-assigned unique ID for this managed resource.

name str
tags Sequence[str]

Required tags of the application to find

id String

The provider-assigned unique ID for this managed resource.

name String
tags List<String>

Required tags of the application to find

Package Details

Repository
https://github.com/lbrlabs/pulumi-dynatrace
License
Apache-2.0
Notes

This Pulumi package is based on the dynatrace Terraform Provider.