Dynatrace

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

getAlertingProfile

The Alerting Profile queries for an Alerting Profile that has a specified name. In case multiple Alerting Profiles share the same name the first one found will be used. The ID of this Data Resource aligns with the IDs used by the Dynatrace Settings 2.0 API.

Example Usage

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

return await Deployment.RunAsync(() => 
{
    var @default = Dynatrace.GetAlertingProfile.Invoke(new()
    {
        Name = "Default",
    });

    var myWebhookNotification = new Dynatrace.WebhookNotification("myWebhookNotification", new()
    {
        Active = false,
        Profile = @default.Apply(getAlertingProfileResult => getAlertingProfileResult).Apply(@default => @default.Apply(getAlertingProfileResult => getAlertingProfileResult.Id)),
        Url = "https://webhook.site/40bf4d43-1a50-4ebd-913d-bf50ce7c3a1e",
        Insecure = true,
        NotifyEventMerges = true,
        NotifyClosedProblems = true,
        Payload = "web-hook-payload",
    });

});
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 {
		_default, err := dynatrace.LookupAlertingProfile(ctx, &GetAlertingProfileArgs{
			Name: "Default",
		}, nil)
		if err != nil {
			return err
		}
		_, err = dynatrace.NewWebhookNotification(ctx, "myWebhookNotification", &dynatrace.WebhookNotificationArgs{
			Active:               pulumi.Bool(false),
			Profile:              pulumi.String(_default.Id),
			Url:                  pulumi.String("https://webhook.site/40bf4d43-1a50-4ebd-913d-bf50ce7c3a1e"),
			Insecure:             pulumi.Bool(true),
			NotifyEventMerges:    pulumi.Bool(true),
			NotifyClosedProblems: pulumi.Bool(true),
			Payload:              pulumi.String("web-hook-payload"),
		})
		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.GetAlertingProfileArgs;
import com.pulumi.dynatrace.WebhookNotification;
import com.pulumi.dynatrace.WebhookNotificationArgs;
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 default = DynatraceFunctions.getAlertingProfile(GetAlertingProfileArgs.builder()
            .name("Default")
            .build());

        var myWebhookNotification = new WebhookNotification("myWebhookNotification", WebhookNotificationArgs.builder()        
            .active(false)
            .profile(default_.id())
            .url("https://webhook.site/40bf4d43-1a50-4ebd-913d-bf50ce7c3a1e")
            .insecure(true)
            .notifyEventMerges(true)
            .notifyClosedProblems(true)
            .payload("web-hook-payload")
            .build());

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

default = dynatrace.get_alerting_profile(name="Default")
my_webhook_notification = dynatrace.WebhookNotification("myWebhookNotification",
    active=False,
    profile=default.id,
    url="https://webhook.site/40bf4d43-1a50-4ebd-913d-bf50ce7c3a1e",
    insecure=True,
    notify_event_merges=True,
    notify_closed_problems=True,
    payload="web-hook-payload")
import * as pulumi from "@pulumi/pulumi";
import * as dynatrace from "@lbrlabs/pulumi-dynatrace";
import * as dynatrace from "@pulumi/dynatrace";

const default = dynatrace.getAlertingProfile({
    name: "Default",
});
const myWebhookNotification = new dynatrace.WebhookNotification("myWebhookNotification", {
    active: false,
    profile: _default.then(_default => _default.id),
    url: "https://webhook.site/40bf4d43-1a50-4ebd-913d-bf50ce7c3a1e",
    insecure: true,
    notifyEventMerges: true,
    notifyClosedProblems: true,
    payload: "web-hook-payload",
});
resources:
  myWebhookNotification:
    type: dynatrace:WebhookNotification
    properties:
      active: false
      profile: ${default.id}
      url: https://webhook.site/40bf4d43-1a50-4ebd-913d-bf50ce7c3a1e
      insecure: true
      notifyEventMerges: true
      notifyClosedProblems: true
      payload: web-hook-payload
variables:
  default:
    fn::invoke:
      Function: dynatrace:getAlertingProfile
      Arguments:
        name: Default

Using getAlertingProfile

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 getAlertingProfile(args: GetAlertingProfileArgs, opts?: InvokeOptions): Promise<GetAlertingProfileResult>
function getAlertingProfileOutput(args: GetAlertingProfileOutputArgs, opts?: InvokeOptions): Output<GetAlertingProfileResult>
def get_alerting_profile(name: Optional[str] = None,
                         opts: Optional[InvokeOptions] = None) -> GetAlertingProfileResult
def get_alerting_profile_output(name: Optional[pulumi.Input[str]] = None,
                         opts: Optional[InvokeOptions] = None) -> Output[GetAlertingProfileResult]
func LookupAlertingProfile(ctx *Context, args *LookupAlertingProfileArgs, opts ...InvokeOption) (*LookupAlertingProfileResult, error)
func LookupAlertingProfileOutput(ctx *Context, args *LookupAlertingProfileOutputArgs, opts ...InvokeOption) LookupAlertingProfileResultOutput

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

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

The following arguments are supported:

Name string
Name string
name String
name string
name str
name String

getAlertingProfile Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Name string
Id string

The provider-assigned unique ID for this managed resource.

Name string
id String

The provider-assigned unique ID for this managed resource.

name String
id string

The provider-assigned unique ID for this managed resource.

name string
id str

The provider-assigned unique ID for this managed resource.

name str
id String

The provider-assigned unique ID for this managed resource.

name String

Package Details

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

This Pulumi package is based on the dynatrace Terraform Provider.