/
getApplication.go
85 lines (80 loc) · 2.61 KB
/
getApplication.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package newrelic
import (
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// #### DEPRECATED! Use at your own risk. Use the `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
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-newrelic/sdk/v3/go/newrelic"
// "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// app, err := newrelic.GetApplication(ctx, &newrelic.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: newrelic.AlertConditionTermArray{
// &newrelic.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
// })
// }
// ```
func GetApplication(ctx *pulumi.Context, args *GetApplicationArgs, opts ...pulumi.InvokeOption) (*GetApplicationResult, error) {
var rv GetApplicationResult
err := ctx.Invoke("newrelic:index/getApplication:getApplication", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getApplication.
type GetApplicationArgs struct {
// The name of the application in New Relic.
Name string `pulumi:"name"`
}
// A collection of values returned by getApplication.
type GetApplicationResult struct {
// A list of host IDs associated with the application.
HostIds []int `pulumi:"hostIds"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
// A list of instance IDs associated with the application.
InstanceIds []int `pulumi:"instanceIds"`
Name string `pulumi:"name"`
}