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

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

package com.pulumi.azure.appinsights.kotlin

import com.pulumi.azure.appinsights.kotlin.outputs.StandardWebTestRequest
import com.pulumi.azure.appinsights.kotlin.outputs.StandardWebTestValidationRules
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
import com.pulumi.azure.appinsights.kotlin.outputs.StandardWebTestRequest.Companion.toKotlin as standardWebTestRequestToKotlin
import com.pulumi.azure.appinsights.kotlin.outputs.StandardWebTestValidationRules.Companion.toKotlin as standardWebTestValidationRulesToKotlin

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

    public var args: StandardWebTestArgs = StandardWebTestArgs()

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

/**
 * Manages a Application Insights Standard WebTest.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "rg-example",
 *     location: "West Europe",
 * });
 * const exampleInsights = new azure.appinsights.Insights("example", {
 *     name: "example",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     applicationType: "web",
 * });
 * const exampleStandardWebTest = new azure.appinsights.StandardWebTest("example", {
 *     name: "example-test",
 *     resourceGroupName: example.name,
 *     location: "West Europe",
 *     applicationInsightsId: exampleInsights.id,
 *     geoLocations: ["example"],
 *     request: {
 *         url: "http://www.example.com",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="rg-example",
 *     location="West Europe")
 * example_insights = azure.appinsights.Insights("example",
 *     name="example",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     application_type="web")
 * example_standard_web_test = azure.appinsights.StandardWebTest("example",
 *     name="example-test",
 *     resource_group_name=example.name,
 *     location="West Europe",
 *     application_insights_id=example_insights.id,
 *     geo_locations=["example"],
 *     request={
 *         "url": "http://www.example.com",
 *     })
 * ```
 * ```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 = "rg-example",
 *         Location = "West Europe",
 *     });
 *     var exampleInsights = new Azure.AppInsights.Insights("example", new()
 *     {
 *         Name = "example",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         ApplicationType = "web",
 *     });
 *     var exampleStandardWebTest = new Azure.AppInsights.StandardWebTest("example", new()
 *     {
 *         Name = "example-test",
 *         ResourceGroupName = example.Name,
 *         Location = "West Europe",
 *         ApplicationInsightsId = exampleInsights.Id,
 *         GeoLocations = new[]
 *         {
 *             "example",
 *         },
 *         Request = new Azure.AppInsights.Inputs.StandardWebTestRequestArgs
 *         {
 *             Url = "http://www.example.com",
 *         },
 *     });
 * });
 * ```
 * ```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("rg-example"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleInsights, err := appinsights.NewInsights(ctx, "example", &appinsights.InsightsArgs{
 * 			Name:              pulumi.String("example"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			ApplicationType:   pulumi.String("web"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = appinsights.NewStandardWebTest(ctx, "example", &appinsights.StandardWebTestArgs{
 * 			Name:                  pulumi.String("example-test"),
 * 			ResourceGroupName:     example.Name,
 * 			Location:              pulumi.String("West Europe"),
 * 			ApplicationInsightsId: exampleInsights.ID(),
 * 			GeoLocations: pulumi.StringArray{
 * 				pulumi.String("example"),
 * 			},
 * 			Request: &appinsights.StandardWebTestRequestArgs{
 * 				Url: pulumi.String("http://www.example.com"),
 * 			},
 * 		})
 * 		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.appinsights.Insights;
 * import com.pulumi.azure.appinsights.InsightsArgs;
 * import com.pulumi.azure.appinsights.StandardWebTest;
 * import com.pulumi.azure.appinsights.StandardWebTestArgs;
 * import com.pulumi.azure.appinsights.inputs.StandardWebTestRequestArgs;
 * 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("rg-example")
 *             .location("West Europe")
 *             .build());
 *         var exampleInsights = new Insights("exampleInsights", InsightsArgs.builder()
 *             .name("example")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .applicationType("web")
 *             .build());
 *         var exampleStandardWebTest = new StandardWebTest("exampleStandardWebTest", StandardWebTestArgs.builder()
 *             .name("example-test")
 *             .resourceGroupName(example.name())
 *             .location("West Europe")
 *             .applicationInsightsId(exampleInsights.id())
 *             .geoLocations("example")
 *             .request(StandardWebTestRequestArgs.builder()
 *                 .url("http://www.example.com")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: rg-example
 *       location: West Europe
 *   exampleInsights:
 *     type: azure:appinsights:Insights
 *     name: example
 *     properties:
 *       name: example
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       applicationType: web
 *   exampleStandardWebTest:
 *     type: azure:appinsights:StandardWebTest
 *     name: example
 *     properties:
 *       name: example-test
 *       resourceGroupName: ${example.name}
 *       location: West Europe
 *       applicationInsightsId: ${exampleInsights.id}
 *       geoLocations:
 *         - example
 *       request:
 *         url: http://www.example.com
 * ```
 * 
 * ## Import
 * Application Insights Standard WebTests can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:appinsights/standardWebTest:StandardWebTest example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Insights/webTests/appinsightswebtest
 * ```
 */
public class StandardWebTest internal constructor(
    override val javaResource: com.pulumi.azure.appinsights.StandardWebTest,
) : KotlinCustomResource(javaResource, StandardWebTestMapper) {
    /**
     * The ID of the Application Insights instance on which the WebTest operates. Changing this forces a new Application Insights Standard WebTest to be created.
     */
    public val applicationInsightsId: Output
        get() = javaResource.applicationInsightsId().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)
        })

    /**
     * Should the WebTest be enabled?
     */
    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) })

    /**
     * Specifies 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 Azure Region where the Application Insights Standard WebTest should exist. Changing this forces a new Application Insights Standard WebTest to be created. It needs to correlate with location of the parent resource (azurerm_application_insights)
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * The name which should be used for this Application Insights Standard WebTest. Changing this forces a new Application Insights Standard WebTest to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * A `request` block as defined below.
     */
    public val request: Output
        get() = javaResource.request().applyValue({ args0 ->
            args0.let({ args0 ->
                standardWebTestRequestToKotlin(args0)
            })
        })

    /**
     * The name of the Resource Group where the Application Insights Standard WebTest should exist. Changing this forces a new Application Insights Standard WebTest to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * Should the retry on WebTest failure be enabled?
     */
    public val retryEnabled: Output?
        get() = javaResource.retryEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Unique ID of this WebTest. This is typically the same value as the Name field.
     */
    public val syntheticMonitorId: Output
        get() = javaResource.syntheticMonitorId().applyValue({ args0 -> args0 })

    /**
     * A mapping of tags which should be assigned to the Application Insights Standard WebTest.
     */
    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) })

    /**
     * A `validation_rules` block as defined below.
     */
    public val validationRules: Output?
        get() = javaResource.validationRules().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> standardWebTestValidationRulesToKotlin(args0) })
            }).orElse(null)
        })
}

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

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy