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

com.pulumi.azure.appinsights.kotlin.WebTest.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.14.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.appinsights.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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map

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

    public var args: WebTestArgs = WebTestArgs()

    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 WebTestArgsBuilder.() -> Unit) {
        val builder = WebTestArgsBuilder()
        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(): WebTest {
        val builtJavaResource = com.pulumi.azure.appinsights.WebTest(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return WebTest(builtJavaResource)
    }
}

/**
 * Manages an Application Insights WebTest.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "tf-test",
 *     location: "West Europe",
 * });
 * const exampleInsights = new azure.appinsights.Insights("example", {
 *     name: "tf-test-appinsights",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     applicationType: "web",
 * });
 * const exampleWebTest = new azure.appinsights.WebTest("example", {
 *     name: "tf-test-appinsights-webtest",
 *     location: exampleInsights.location,
 *     resourceGroupName: example.name,
 *     applicationInsightsId: exampleInsights.id,
 *     kind: "ping",
 *     frequency: 300,
 *     timeout: 60,
 *     enabled: true,
 *     geoLocations: [
 *         "us-tx-sn1-azr",
 *         "us-il-ch1-azr",
 *     ],
 *     configuration: `
 *   
 *     
 *   
 * 
 * `,
 * });
 * export const webtestId = exampleWebTest.id;
 * export const webtestsSyntheticId = exampleWebTest.syntheticMonitorId;
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="tf-test",
 *     location="West Europe")
 * example_insights = azure.appinsights.Insights("example",
 *     name="tf-test-appinsights",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     application_type="web")
 * example_web_test = azure.appinsights.WebTest("example",
 *     name="tf-test-appinsights-webtest",
 *     location=example_insights.location,
 *     resource_group_name=example.name,
 *     application_insights_id=example_insights.id,
 *     kind="ping",
 *     frequency=300,
 *     timeout=60,
 *     enabled=True,
 *     geo_locations=[
 *         "us-tx-sn1-azr",
 *         "us-il-ch1-azr",
 *     ],
 *     configuration="""
 *   
 *     
 *   
 * 
 * """)
 * pulumi.export("webtestId", example_web_test.id)
 * pulumi.export("webtestsSyntheticId", example_web_test.synthetic_monitor_id)
 * ```
 * ```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 = "tf-test",
 *         Location = "West Europe",
 *     });
 *     var exampleInsights = new Azure.AppInsights.Insights("example", new()
 *     {
 *         Name = "tf-test-appinsights",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         ApplicationType = "web",
 *     });
 *     var exampleWebTest = new Azure.AppInsights.WebTest("example", new()
 *     {
 *         Name = "tf-test-appinsights-webtest",
 *         Location = exampleInsights.Location,
 *         ResourceGroupName = example.Name,
 *         ApplicationInsightsId = exampleInsights.Id,
 *         Kind = "ping",
 *         Frequency = 300,
 *         Timeout = 60,
 *         Enabled = true,
 *         GeoLocations = new[]
 *         {
 *             "us-tx-sn1-azr",
 *             "us-il-ch1-azr",
 *         },
 *         Configuration = @"
 *   
 *     
 *   
 * 
 * ",
 *     });
 *     return new Dictionary
 *     {
 *         ["webtestId"] = exampleWebTest.Id,
 *         ["webtestsSyntheticId"] = exampleWebTest.SyntheticMonitorId,
 *     };
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/appinsights"
 * 	"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 {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("tf-test"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleInsights, err := appinsights.NewInsights(ctx, "example", &appinsights.InsightsArgs{
 * 			Name:              pulumi.String("tf-test-appinsights"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			ApplicationType:   pulumi.String("web"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleWebTest, err := appinsights.NewWebTest(ctx, "example", &appinsights.WebTestArgs{
 * 			Name:                  pulumi.String("tf-test-appinsights-webtest"),
 * 			Location:              exampleInsights.Location,
 * 			ResourceGroupName:     example.Name,
 * 			ApplicationInsightsId: exampleInsights.ID(),
 * 			Kind:                  pulumi.String("ping"),
 * 			Frequency:             pulumi.Int(300),
 * 			Timeout:               pulumi.Int(60),
 * 			Enabled:               pulumi.Bool(true),
 * 			GeoLocations: pulumi.StringArray{
 * 				pulumi.String("us-tx-sn1-azr"),
 * 				pulumi.String("us-il-ch1-azr"),
 * 			},
 * 			Configuration: pulumi.String(`
 *   
 *     
 *   
 * 
 * `),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		ctx.Export("webtestId", exampleWebTest.ID())
 * 		ctx.Export("webtestsSyntheticId", exampleWebTest.SyntheticMonitorId)
 * 		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.appinsights.Insights;
 * import com.pulumi.azure.appinsights.InsightsArgs;
 * import com.pulumi.azure.appinsights.WebTest;
 * import com.pulumi.azure.appinsights.WebTestArgs;
 * 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("tf-test")
 *             .location("West Europe")
 *             .build());
 *         var exampleInsights = new Insights("exampleInsights", InsightsArgs.builder()
 *             .name("tf-test-appinsights")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .applicationType("web")
 *             .build());
 *         var exampleWebTest = new WebTest("exampleWebTest", WebTestArgs.builder()
 *             .name("tf-test-appinsights-webtest")
 *             .location(exampleInsights.location())
 *             .resourceGroupName(example.name())
 *             .applicationInsightsId(exampleInsights.id())
 *             .kind("ping")
 *             .frequency(300)
 *             .timeout(60)
 *             .enabled(true)
 *             .geoLocations(
 *                 "us-tx-sn1-azr",
 *                 "us-il-ch1-azr")
 *             .configuration("""
 * 
 *   
 *     
 *   
 * 
 *             """)
 *             .build());
 *         ctx.export("webtestId", exampleWebTest.id());
 *         ctx.export("webtestsSyntheticId", exampleWebTest.syntheticMonitorId());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: tf-test
 *       location: West Europe
 *   exampleInsights:
 *     type: azure:appinsights:Insights
 *     name: example
 *     properties:
 *       name: tf-test-appinsights
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       applicationType: web
 *   exampleWebTest:
 *     type: azure:appinsights:WebTest
 *     name: example
 *     properties:
 *       name: tf-test-appinsights-webtest
 *       location: ${exampleInsights.location}
 *       resourceGroupName: ${example.name}
 *       applicationInsightsId: ${exampleInsights.id}
 *       kind: ping
 *       frequency: 300
 *       timeout: 60
 *       enabled: true
 *       geoLocations:
 *         - us-tx-sn1-azr
 *         - us-il-ch1-azr
 *       configuration: |
 *         
 *           
 *             
 *           
 *         
 * outputs:
 *   webtestId: ${exampleWebTest.id}
 *   webtestsSyntheticId: ${exampleWebTest.syntheticMonitorId}
 * ```
 * 
 * ## Import
 * Application Insights Web Tests can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:appinsights/webTest:WebTest my_test /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Insights/webTests/my_test
 * ```
 */
public class WebTest internal constructor(
    override val javaResource: com.pulumi.azure.appinsights.WebTest,
) : KotlinCustomResource(javaResource, WebTestMapper) {
    /**
     * The ID of the Application Insights component on which the WebTest operates. Changing this forces a new resource to be created.
     */
    public val applicationInsightsId: Output
        get() = javaResource.applicationInsightsId().applyValue({ args0 -> args0 })

    /**
     * An XML configuration specification for a WebTest ([see here for more information](https://docs.microsoft.com/rest/api/application-insights/webtests/createorupdate/)).
     */
    public val configuration: Output
        get() = javaResource.configuration().applyValue({ args0 -> args0 })

    /**
     * Purpose/user defined descriptive test for this WebTest.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Is the test actively being monitored.
     */
    public val enabled: Output?
        get() = javaResource.enabled().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Interval in seconds between test runs for this WebTest. Valid options are `300`, `600` and `900`. Defaults to `300`.
     */
    public val frequency: Output?
        get() = javaResource.frequency().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * A list of where to physically run the tests from to give global coverage for accessibility of your application.
     * > **Note:** [Valid options for geo locations are described here](https://docs.microsoft.com/azure/azure-monitor/app/monitor-web-app-availability#location-population-tags)
     */
    public val geoLocations: Output>
        get() = javaResource.geoLocations().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * The kind of web test that this web test watches. Choices are `ping` and `multistep`. Changing this forces a new resource to be created.
     */
    public val kind: Output
        get() = javaResource.kind().applyValue({ args0 -> args0 })

    /**
     * Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. It needs to correlate with location of parent resource (azurerm_application_insights).
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * Specifies the name of the Application Insights WebTest. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The name of the resource group in which to create the Application Insights WebTest. Changing this forces a new resource
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * Allow for retries should this WebTest fail.
     */
    public val retryEnabled: Output?
        get() = javaResource.retryEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    public val syntheticMonitorId: Output
        get() = javaResource.syntheticMonitorId().applyValue({ args0 -> args0 })

    /**
     * A mapping of tags to assign to the resource.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * Seconds until this WebTest will timeout and fail. Default is `30`.
     */
    public val timeout: Output?
        get() = javaResource.timeout().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}

public object WebTestMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.appinsights.WebTest::class == javaResource::class

    override fun map(javaResource: Resource): WebTest = WebTest(
        javaResource as
            com.pulumi.azure.appinsights.WebTest,
    )
}

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy