All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.azure.datadog.kotlin.MonitorArgs.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.datadog.kotlin

import com.pulumi.azure.datadog.MonitorArgs.builder
import com.pulumi.azure.datadog.kotlin.inputs.MonitorDatadogOrganizationArgs
import com.pulumi.azure.datadog.kotlin.inputs.MonitorDatadogOrganizationArgsBuilder
import com.pulumi.azure.datadog.kotlin.inputs.MonitorIdentityArgs
import com.pulumi.azure.datadog.kotlin.inputs.MonitorIdentityArgsBuilder
import com.pulumi.azure.datadog.kotlin.inputs.MonitorUserArgs
import com.pulumi.azure.datadog.kotlin.inputs.MonitorUserArgsBuilder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Boolean
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * Manages a datadog Monitor.
 * ## Example Usage
 * ### Monitor creation with linking to Datadog organization
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-datadog",
 *     location: "West US 2",
 * });
 * const exampleMonitor = new azure.datadog.Monitor("example", {
 *     name: "example-monitor",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     datadogOrganization: {
 *         apiKey: "XXXX",
 *         applicationKey: "XXXX",
 *     },
 *     user: {
 *         name: "Example",
 *         email: "[email protected]",
 *     },
 *     skuName: "Linked",
 *     identity: {
 *         type: "SystemAssigned",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-datadog",
 *     location="West US 2")
 * example_monitor = azure.datadog.Monitor("example",
 *     name="example-monitor",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     datadog_organization={
 *         "api_key": "XXXX",
 *         "application_key": "XXXX",
 *     },
 *     user={
 *         "name": "Example",
 *         "email": "[email protected]",
 *     },
 *     sku_name="Linked",
 *     identity={
 *         "type": "SystemAssigned",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-datadog",
 *         Location = "West US 2",
 *     });
 *     var exampleMonitor = new Azure.Datadog.Monitor("example", new()
 *     {
 *         Name = "example-monitor",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         DatadogOrganization = new Azure.Datadog.Inputs.MonitorDatadogOrganizationArgs
 *         {
 *             ApiKey = "XXXX",
 *             ApplicationKey = "XXXX",
 *         },
 *         User = new Azure.Datadog.Inputs.MonitorUserArgs
 *         {
 *             Name = "Example",
 *             Email = "[email protected]",
 *         },
 *         SkuName = "Linked",
 *         Identity = new Azure.Datadog.Inputs.MonitorIdentityArgs
 *         {
 *             Type = "SystemAssigned",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/datadog"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-datadog"),
 * 			Location: pulumi.String("West US 2"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = datadog.NewMonitor(ctx, "example", &datadog.MonitorArgs{
 * 			Name:              pulumi.String("example-monitor"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 			DatadogOrganization: &datadog.MonitorDatadogOrganizationArgs{
 * 				ApiKey:         pulumi.String("XXXX"),
 * 				ApplicationKey: pulumi.String("XXXX"),
 * 			},
 * 			User: &datadog.MonitorUserArgs{
 * 				Name:  pulumi.String("Example"),
 * 				Email: pulumi.String("[email protected]"),
 * 			},
 * 			SkuName: pulumi.String("Linked"),
 * 			Identity: &datadog.MonitorIdentityArgs{
 * 				Type: pulumi.String("SystemAssigned"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.datadog.Monitor;
 * import com.pulumi.azure.datadog.MonitorArgs;
 * import com.pulumi.azure.datadog.inputs.MonitorDatadogOrganizationArgs;
 * import com.pulumi.azure.datadog.inputs.MonitorUserArgs;
 * import com.pulumi.azure.datadog.inputs.MonitorIdentityArgs;
 * 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) {
 *         var example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("example-datadog")
 *             .location("West US 2")
 *             .build());
 *         var exampleMonitor = new Monitor("exampleMonitor", MonitorArgs.builder()
 *             .name("example-monitor")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .datadogOrganization(MonitorDatadogOrganizationArgs.builder()
 *                 .apiKey("XXXX")
 *                 .applicationKey("XXXX")
 *                 .build())
 *             .user(MonitorUserArgs.builder()
 *                 .name("Example")
 *                 .email("[email protected]")
 *                 .build())
 *             .skuName("Linked")
 *             .identity(MonitorIdentityArgs.builder()
 *                 .type("SystemAssigned")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-datadog
 *       location: West US 2
 *   exampleMonitor:
 *     type: azure:datadog:Monitor
 *     name: example
 *     properties:
 *       name: example-monitor
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       datadogOrganization:
 *         apiKey: XXXX
 *         applicationKey: XXXX
 *       user:
 *         name: Example
 *         email: [email protected]
 *       skuName: Linked
 *       identity:
 *         type: SystemAssigned
 * ```
 * 
 * ## Role Assignment
 * To enable metrics flow, perform role assignment on the identity created above. `Monitoring reader(43d0d8ad-25c7-4714-9337-8ba259a9fe05)` role is required .
 * ### Role assignment on the monitor created
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const primary = azure.core.getSubscription({});
 * const monitoringReader = azure.authorization.getRoleDefinition({
 *     name: "Monitoring Reader",
 * });
 * const example = new azure.authorization.Assignment("example", {
 *     scope: primary.then(primary => primary.id),
 *     roleDefinitionId: monitoringReader.then(monitoringReader => monitoringReader.roleDefinitionId),
 *     principalId: exampleAzurermDatadogMonitor.identity[0].principalId,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * primary = azure.core.get_subscription()
 * monitoring_reader = azure.authorization.get_role_definition(name="Monitoring Reader")
 * example = azure.authorization.Assignment("example",
 *     scope=primary.id,
 *     role_definition_id=monitoring_reader.role_definition_id,
 *     principal_id=example_azurerm_datadog_monitor["identity"][0]["principalId"])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var primary = Azure.Core.GetSubscription.Invoke();
 *     var monitoringReader = Azure.Authorization.GetRoleDefinition.Invoke(new()
 *     {
 *         Name = "Monitoring Reader",
 *     });
 *     var example = new Azure.Authorization.Assignment("example", new()
 *     {
 *         Scope = primary.Apply(getSubscriptionResult => getSubscriptionResult.Id),
 *         RoleDefinitionId = monitoringReader.Apply(getRoleDefinitionResult => getRoleDefinitionResult.RoleDefinitionId),
 *         PrincipalId = exampleAzurermDatadogMonitor.Identity[0].PrincipalId,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/authorization"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		primary, err := core.LookupSubscription(ctx, nil, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		monitoringReader, err := authorization.LookupRoleDefinition(ctx, &authorization.LookupRoleDefinitionArgs{
 * 			Name: pulumi.StringRef("Monitoring Reader"),
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = authorization.NewAssignment(ctx, "example", &authorization.AssignmentArgs{
 * 			Scope:            pulumi.String(primary.Id),
 * 			RoleDefinitionId: pulumi.String(monitoringReader.RoleDefinitionId),
 * 			PrincipalId:      pulumi.Any(exampleAzurermDatadogMonitor.Identity[0].PrincipalId),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azure.core.CoreFunctions;
 * import com.pulumi.azure.core.inputs.GetSubscriptionArgs;
 * import com.pulumi.azure.authorization.AuthorizationFunctions;
 * import com.pulumi.azure.authorization.inputs.GetRoleDefinitionArgs;
 * import com.pulumi.azure.authorization.Assignment;
 * import com.pulumi.azure.authorization.AssignmentArgs;
 * 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 primary = CoreFunctions.getSubscription();
 *         final var monitoringReader = AuthorizationFunctions.getRoleDefinition(GetRoleDefinitionArgs.builder()
 *             .name("Monitoring Reader")
 *             .build());
 *         var example = new Assignment("example", AssignmentArgs.builder()
 *             .scope(primary.applyValue(getSubscriptionResult -> getSubscriptionResult.id()))
 *             .roleDefinitionId(monitoringReader.applyValue(getRoleDefinitionResult -> getRoleDefinitionResult.roleDefinitionId()))
 *             .principalId(exampleAzurermDatadogMonitor.identity()[0].principalId())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:authorization:Assignment
 *     properties:
 *       scope: ${primary.id}
 *       roleDefinitionId: ${monitoringReader.roleDefinitionId}
 *       principalId: ${exampleAzurermDatadogMonitor.identity[0].principalId}
 * variables:
 *   primary:
 *     fn::invoke:
 *       Function: azure:core:getSubscription
 *       Arguments: {}
 *   monitoringReader:
 *     fn::invoke:
 *       Function: azure:authorization:getRoleDefinition
 *       Arguments:
 *         name: Monitoring Reader
 * ```
 * 
 * ## Import
 * Datadog Monitors can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:datadog/monitor:Monitor example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Datadog/monitors/monitor1
 * ```
 * @property datadogOrganization A `datadog_organization` block as defined below.
 * @property identity A `identity` block as defined below.
 * @property location The Azure Region where the Datadog Monitor should exist. Changing this forces a new Datadog Monitor to be created.
 * @property monitoringEnabled Is monitoring enabled? Defaults to `true`.
 * @property name The name of the user that will be associated with the Datadog Monitor. Changing this forces a new Datadog Monitor to be created.
 * @property resourceGroupName The name of the Resource Group where the Datadog Monitor should exist. Changing this forces a new Datadog Monitor to be created.
 * @property skuName The name which should be used for this sku.
 * @property tags A mapping of tags which should be assigned to the Datadog Monitor.
 * @property user A `user` block as defined below.
 */
public data class MonitorArgs(
    public val datadogOrganization: Output? = null,
    public val identity: Output? = null,
    public val location: Output? = null,
    public val monitoringEnabled: Output? = null,
    public val name: Output? = null,
    public val resourceGroupName: Output? = null,
    public val skuName: Output? = null,
    public val tags: Output>? = null,
    public val user: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.datadog.MonitorArgs =
        com.pulumi.azure.datadog.MonitorArgs.builder()
            .datadogOrganization(
                datadogOrganization?.applyValue({ args0 ->
                    args0.let({ args0 ->
                        args0.toJava()
                    })
                }),
            )
            .identity(identity?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .location(location?.applyValue({ args0 -> args0 }))
            .monitoringEnabled(monitoringEnabled?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .resourceGroupName(resourceGroupName?.applyValue({ args0 -> args0 }))
            .skuName(skuName?.applyValue({ args0 -> args0 }))
            .tags(tags?.applyValue({ args0 -> args0.map({ args0 -> args0.key.to(args0.value) }).toMap() }))
            .user(user?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) })).build()
}

/**
 * Builder for [MonitorArgs].
 */
@PulumiTagMarker
public class MonitorArgsBuilder internal constructor() {
    private var datadogOrganization: Output? = null

    private var identity: Output? = null

    private var location: Output? = null

    private var monitoringEnabled: Output? = null

    private var name: Output? = null

    private var resourceGroupName: Output? = null

    private var skuName: Output? = null

    private var tags: Output>? = null

    private var user: Output? = null

    /**
     * @param value A `datadog_organization` block as defined below.
     */
    @JvmName("ginycrajmmcolyxx")
    public suspend fun datadogOrganization(`value`: Output) {
        this.datadogOrganization = value
    }

    /**
     * @param value A `identity` block as defined below.
     */
    @JvmName("cecqneeoebofhhpb")
    public suspend fun identity(`value`: Output) {
        this.identity = value
    }

    /**
     * @param value The Azure Region where the Datadog Monitor should exist. Changing this forces a new Datadog Monitor to be created.
     */
    @JvmName("kogojivdbjucovrx")
    public suspend fun location(`value`: Output) {
        this.location = value
    }

    /**
     * @param value Is monitoring enabled? Defaults to `true`.
     */
    @JvmName("buyinrcncucfvgsf")
    public suspend fun monitoringEnabled(`value`: Output) {
        this.monitoringEnabled = value
    }

    /**
     * @param value The name of the user that will be associated with the Datadog Monitor. Changing this forces a new Datadog Monitor to be created.
     */
    @JvmName("gyyvuerxffsbobjy")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value The name of the Resource Group where the Datadog Monitor should exist. Changing this forces a new Datadog Monitor to be created.
     */
    @JvmName("jlymuptpddvlfntg")
    public suspend fun resourceGroupName(`value`: Output) {
        this.resourceGroupName = value
    }

    /**
     * @param value The name which should be used for this sku.
     */
    @JvmName("qmrduswqarspldpd")
    public suspend fun skuName(`value`: Output) {
        this.skuName = value
    }

    /**
     * @param value A mapping of tags which should be assigned to the Datadog Monitor.
     */
    @JvmName("yphscgkxcbqxxfyd")
    public suspend fun tags(`value`: Output>) {
        this.tags = value
    }

    /**
     * @param value A `user` block as defined below.
     */
    @JvmName("oetfsoiqevqcrmrf")
    public suspend fun user(`value`: Output) {
        this.user = value
    }

    /**
     * @param value A `datadog_organization` block as defined below.
     */
    @JvmName("ewcdowdmcjgqswba")
    public suspend fun datadogOrganization(`value`: MonitorDatadogOrganizationArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.datadogOrganization = mapped
    }

    /**
     * @param argument A `datadog_organization` block as defined below.
     */
    @JvmName("hijimokddumfbbqc")
    public suspend fun datadogOrganization(argument: suspend MonitorDatadogOrganizationArgsBuilder.() -> Unit) {
        val toBeMapped = MonitorDatadogOrganizationArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.datadogOrganization = mapped
    }

    /**
     * @param value A `identity` block as defined below.
     */
    @JvmName("cvwcnhpeqswjwsxa")
    public suspend fun identity(`value`: MonitorIdentityArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.identity = mapped
    }

    /**
     * @param argument A `identity` block as defined below.
     */
    @JvmName("jfshvtjabftbagms")
    public suspend fun identity(argument: suspend MonitorIdentityArgsBuilder.() -> Unit) {
        val toBeMapped = MonitorIdentityArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.identity = mapped
    }

    /**
     * @param value The Azure Region where the Datadog Monitor should exist. Changing this forces a new Datadog Monitor to be created.
     */
    @JvmName("ynotbttwblbxtmpd")
    public suspend fun location(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.location = mapped
    }

    /**
     * @param value Is monitoring enabled? Defaults to `true`.
     */
    @JvmName("sxpwxpyyfuchcjml")
    public suspend fun monitoringEnabled(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.monitoringEnabled = mapped
    }

    /**
     * @param value The name of the user that will be associated with the Datadog Monitor. Changing this forces a new Datadog Monitor to be created.
     */
    @JvmName("fvevwpblvsslgctx")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value The name of the Resource Group where the Datadog Monitor should exist. Changing this forces a new Datadog Monitor to be created.
     */
    @JvmName("tgptnacdpgyucwcp")
    public suspend fun resourceGroupName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceGroupName = mapped
    }

    /**
     * @param value The name which should be used for this sku.
     */
    @JvmName("tohanidmqxvletqx")
    public suspend fun skuName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.skuName = mapped
    }

    /**
     * @param value A mapping of tags which should be assigned to the Datadog Monitor.
     */
    @JvmName("sktpdtnykuteysvl")
    public suspend fun tags(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param values A mapping of tags which should be assigned to the Datadog Monitor.
     */
    @JvmName("fwjgrcgcwmnygccu")
    public fun tags(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param value A `user` block as defined below.
     */
    @JvmName("vqstwgynncbcqxax")
    public suspend fun user(`value`: MonitorUserArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.user = mapped
    }

    /**
     * @param argument A `user` block as defined below.
     */
    @JvmName("vbkurtlduesibhfc")
    public suspend fun user(argument: suspend MonitorUserArgsBuilder.() -> Unit) {
        val toBeMapped = MonitorUserArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.user = mapped
    }

    internal fun build(): MonitorArgs = MonitorArgs(
        datadogOrganization = datadogOrganization,
        identity = identity,
        location = location,
        monitoringEnabled = monitoringEnabled,
        name = name,
        resourceGroupName = resourceGroupName,
        skuName = skuName,
        tags = tags,
        user = user,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy