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

com.pulumi.aws.amp.kotlin.AlertManagerDefinition.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.57.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.aws.amp.kotlin

import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit

/**
 * Builder for [AlertManagerDefinition].
 */
@PulumiTagMarker
public class AlertManagerDefinitionResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: AlertManagerDefinitionArgs = AlertManagerDefinitionArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend AlertManagerDefinitionArgsBuilder.() -> Unit) {
        val builder = AlertManagerDefinitionArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): AlertManagerDefinition {
        val builtJavaResource = com.pulumi.aws.amp.AlertManagerDefinition(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return AlertManagerDefinition(builtJavaResource)
    }
}

/**
 * Manages an Amazon Managed Service for Prometheus (AMP) Alert Manager Definition
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const demo = new aws.amp.Workspace("demo", {});
 * const demoAlertManagerDefinition = new aws.amp.AlertManagerDefinition("demo", {
 *     workspaceId: demo.id,
 *     definition: `alertmanager_config: |
 *   route:
 *     receiver: 'default'
 *   receivers:
 *     - name: 'default'
 * `,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * demo = aws.amp.Workspace("demo")
 * demo_alert_manager_definition = aws.amp.AlertManagerDefinition("demo",
 *     workspace_id=demo.id,
 *     definition="""alertmanager_config: |
 *   route:
 *     receiver: 'default'
 *   receivers:
 *     - name: 'default'
 * """)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var demo = new Aws.Amp.Workspace("demo");
 *     var demoAlertManagerDefinition = new Aws.Amp.AlertManagerDefinition("demo", new()
 *     {
 *         WorkspaceId = demo.Id,
 *         Definition = @"alertmanager_config: |
 *   route:
 *     receiver: 'default'
 *   receivers:
 *     - name: 'default'
 * ",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/amp"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		demo, err := amp.NewWorkspace(ctx, "demo", nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = amp.NewAlertManagerDefinition(ctx, "demo", &.AlertManagerDefinitionArgs{
 * 			WorkspaceId: demo.ID(),
 * 			Definition: pulumi.String(`alertmanager_config: |
 *   route:
 *     receiver: 'default'
 *   receivers:
 *     - name: 'default'
 * `),
 * 		})
 * 		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.aws.amp.Workspace;
 * import com.pulumi.aws.amp.AlertManagerDefinition;
 * import com.pulumi.aws.amp.AlertManagerDefinitionArgs;
 * 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 demo = new Workspace("demo");
 *         var demoAlertManagerDefinition = new AlertManagerDefinition("demoAlertManagerDefinition", AlertManagerDefinitionArgs.builder()
 *             .workspaceId(demo.id())
 *             .definition("""
 * alertmanager_config: |
 *   route:
 *     receiver: 'default'
 *   receivers:
 *     - name: 'default'
 *             """)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   demo:
 *     type: aws:amp:Workspace
 *   demoAlertManagerDefinition:
 *     type: aws:amp:AlertManagerDefinition
 *     name: demo
 *     properties:
 *       workspaceId: ${demo.id}
 *       definition: |
 *         alertmanager_config: |
 *           route:
 *             receiver: 'default'
 *           receivers:
 *             - name: 'default'
 * ```
 * 
 * ## Import
 * Using `pulumi import`, import the prometheus alert manager definition using the workspace identifier. For example:
 * ```sh
 * $ pulumi import aws:amp/alertManagerDefinition:AlertManagerDefinition demo ws-C6DCB907-F2D7-4D96-957B-66691F865D8B
 * ```
 */
public class AlertManagerDefinition internal constructor(
    override val javaResource: com.pulumi.aws.amp.AlertManagerDefinition,
) : KotlinCustomResource(javaResource, AlertManagerDefinitionMapper) {
    /**
     * the alert manager definition that you want to be applied. See more [in AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-alert-manager.html).
     */
    public val definition: Output
        get() = javaResource.definition().applyValue({ args0 -> args0 })

    /**
     * ID of the prometheus workspace the alert manager definition should be linked to
     */
    public val workspaceId: Output
        get() = javaResource.workspaceId().applyValue({ args0 -> args0 })
}

public object AlertManagerDefinitionMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.aws.amp.AlertManagerDefinition::class == javaResource::class

    override fun map(javaResource: Resource): AlertManagerDefinition =
        AlertManagerDefinition(javaResource as com.pulumi.aws.amp.AlertManagerDefinition)
}

/**
 * @see [AlertManagerDefinition].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [AlertManagerDefinition].
 */
public suspend fun alertManagerDefinition(
    name: String,
    block: suspend AlertManagerDefinitionResourceBuilder.() -> Unit,
): AlertManagerDefinition {
    val builder = AlertManagerDefinitionResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [AlertManagerDefinition].
 * @param name The _unique_ name of the resulting resource.
 */
public fun alertManagerDefinition(name: String): AlertManagerDefinition {
    val builder = AlertManagerDefinitionResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy