New Relic

Pulumi Official
Package maintained by Pulumi
v4.19.0 published on Wednesday, Jul 20, 2022 by Pulumi

getApplication

DEPRECATED! Use at your own risk. Use the newrelic.getEntity data source instead. This feature may be removed in the next major release

Use this data source to get information about a specific application in New Relic that already exists.

Example Usage

using Pulumi;
using NewRelic = Pulumi.NewRelic;

class MyStack : Stack
{
    public MyStack()
    {
        var app = Output.Create(NewRelic.GetApplication.InvokeAsync(new NewRelic.GetApplicationArgs
        {
            Name = "my-app",
        }));
        var fooAlertPolicy = new NewRelic.AlertPolicy("fooAlertPolicy", new NewRelic.AlertPolicyArgs
        {
        });
        var fooAlertCondition = new NewRelic.AlertCondition("fooAlertCondition", new NewRelic.AlertConditionArgs
        {
            PolicyId = fooAlertPolicy.Id,
            Type = "apm_app_metric",
            Entities = 
            {
                app.Apply(app => app.Id),
            },
            Metric = "apdex",
            RunbookUrl = "https://www.example.com",
            Terms = 
            {
                new NewRelic.Inputs.AlertConditionTermArgs
                {
                    Duration = 5,
                    Operator = "below",
                    Priority = "critical",
                    Threshold = 0.75,
                    TimeFunction = "all",
                },
            },
        });
    }

}
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		app, err := newrelic.GetApplication(ctx, &GetApplicationArgs{
			Name: "my-app",
		}, nil)
		if err != nil {
			return err
		}
		fooAlertPolicy, err := newrelic.NewAlertPolicy(ctx, "fooAlertPolicy", nil)
		if err != nil {
			return err
		}
		_, err = newrelic.NewAlertCondition(ctx, "fooAlertCondition", &newrelic.AlertConditionArgs{
			PolicyId: fooAlertPolicy.ID(),
			Type:     pulumi.String("apm_app_metric"),
			Entities: pulumi.IntArray{
				pulumi.String(app.Id),
			},
			Metric:     pulumi.String("apdex"),
			RunbookUrl: pulumi.String("https://www.example.com"),
			Terms: AlertConditionTermArray{
				&AlertConditionTermArgs{
					Duration:     pulumi.Int(5),
					Operator:     pulumi.String("below"),
					Priority:     pulumi.String("critical"),
					Threshold:    pulumi.Float64(0.75),
					TimeFunction: pulumi.String("all"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var app = Output.of(NewrelicFunctions.getApplication(GetApplicationArgs.builder()
            .name("my-app")
            .build()));

        var fooAlertPolicy = new AlertPolicy("fooAlertPolicy");

        var fooAlertCondition = new AlertCondition("fooAlertCondition", AlertConditionArgs.builder()        
            .policyId(fooAlertPolicy.getId())
            .type("apm_app_metric")
            .entities(app.apply(getApplicationResult -> getApplicationResult.getId()))
            .metric("apdex")
            .runbookUrl("https://www.example.com")
            .terms(AlertConditionTerm.builder()
                .duration(5)
                .operator("below")
                .priority("critical")
                .threshold("0.75")
                .timeFunction("all")
                .build())
            .build());

        }
}
import pulumi
import pulumi_newrelic as newrelic

app = newrelic.get_application(name="my-app")
foo_alert_policy = newrelic.AlertPolicy("fooAlertPolicy")
foo_alert_condition = newrelic.AlertCondition("fooAlertCondition",
    policy_id=foo_alert_policy.id,
    type="apm_app_metric",
    entities=[app.id],
    metric="apdex",
    runbook_url="https://www.example.com",
    terms=[newrelic.AlertConditionTermArgs(
        duration=5,
        operator="below",
        priority="critical",
        threshold=0.75,
        time_function="all",
    )])
import * as pulumi from "@pulumi/pulumi";
import * as newrelic from "@pulumi/newrelic";

const app = newrelic.getApplication({
    name: "my-app",
});
const fooAlertPolicy = new newrelic.AlertPolicy("fooAlertPolicy", {});
const fooAlertCondition = new newrelic.AlertCondition("fooAlertCondition", {
    policyId: fooAlertPolicy.id,
    type: "apm_app_metric",
    entities: [app.then(app => app.id)],
    metric: "apdex",
    runbookUrl: "https://www.example.com",
    terms: [{
        duration: 5,
        operator: "below",
        priority: "critical",
        threshold: 0.75,
        timeFunction: "all",
    }],
});
resources:
  fooAlertPolicy:
    type: newrelic:AlertPolicy
  fooAlertCondition:
    type: newrelic:AlertCondition
    properties:
      policyId: ${fooAlertPolicy.id}
      type: apm_app_metric
      entities:
        - ${app.id}
      metric: apdex
      runbookUrl: https://www.example.com
      terms:
        - duration: 5
          operator: below
          priority: critical
          threshold: 0.75
          timeFunction: all
variables:
  app:
    Fn::Invoke:
      Function: newrelic:getApplication
      Arguments:
        name: my-app

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,
                    opts: Optional[InvokeOptions] = None) -> GetApplicationResult
def get_application_output(name: Optional[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: newrelic:index/getApplication:getApplication
  Arguments:
    # Arguments dictionary

The following arguments are supported:

Name string

The name of the application in New Relic.

Name string

The name of the application in New Relic.

name String

The name of the application in New Relic.

name string

The name of the application in New Relic.

name str

The name of the application in New Relic.

name String

The name of the application in New Relic.

getApplication Result

The following output properties are available:

HostIds List<int>

A list of host IDs associated with the application.

Id string

The provider-assigned unique ID for this managed resource.

InstanceIds List<int>

A list of instance IDs associated with the application.

Name string
HostIds []int

A list of host IDs associated with the application.

Id string

The provider-assigned unique ID for this managed resource.

InstanceIds []int

A list of instance IDs associated with the application.

Name string
hostIds List<Integer>

A list of host IDs associated with the application.

id String

The provider-assigned unique ID for this managed resource.

instanceIds List<Integer>

A list of instance IDs associated with the application.

name String
hostIds number[]

A list of host IDs associated with the application.

id string

The provider-assigned unique ID for this managed resource.

instanceIds number[]

A list of instance IDs associated with the application.

name string
host_ids Sequence[int]

A list of host IDs associated with the application.

id str

The provider-assigned unique ID for this managed resource.

instance_ids Sequence[int]

A list of instance IDs associated with the application.

name str
hostIds List<Number>

A list of host IDs associated with the application.

id String

The provider-assigned unique ID for this managed resource.

instanceIds List<Number>

A list of instance IDs associated with the application.

name String

Package Details

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

This Pulumi package is based on the newrelic Terraform Provider.