com.pulumi.azurenative.loadtestservice.kotlin.LoadTestMapping.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azurenative.loadtestservice.kotlin
import com.pulumi.azurenative.loadtestservice.kotlin.outputs.SystemDataResponse
import com.pulumi.azurenative.loadtestservice.kotlin.outputs.SystemDataResponse.Companion.toKotlin
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 [LoadTestMapping].
*/
@PulumiTagMarker
public class LoadTestMappingResourceBuilder internal constructor() {
public var name: String? = null
public var args: LoadTestMappingArgs = LoadTestMappingArgs()
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 LoadTestMappingArgsBuilder.() -> Unit) {
val builder = LoadTestMappingArgsBuilder()
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(): LoadTestMapping {
val builtJavaResource =
com.pulumi.azurenative.loadtestservice.LoadTestMapping(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return LoadTestMapping(builtJavaResource)
}
}
/**
* LoadTest mapping resource details
* Azure REST API version: 2023-12-01-preview.
* ## Example Usage
* ### Create a Load Test Mapping Resource
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using AzureNative = Pulumi.AzureNative;
* return await Deployment.RunAsync(() =>
* {
* var loadTestMapping = new AzureNative.LoadTestService.LoadTestMapping("loadTestMapping", new()
* {
* AzureLoadTestingResourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.LoadTestService/loadTests/myLoadTest",
* LoadTestMappingName = "myLoadTestMapping",
* ResourceUri = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.Web/sites/sitename",
* SourceResourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.Web/sites/sitename",
* TestId = "123456",
* });
* });
* ```
* ```go
* package main
* import (
* loadtestservice "github.com/pulumi/pulumi-azure-native-sdk/loadtestservice/v2"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := loadtestservice.NewLoadTestMapping(ctx, "loadTestMapping", &loadtestservice.LoadTestMappingArgs{
* AzureLoadTestingResourceId: pulumi.String("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.LoadTestService/loadTests/myLoadTest"),
* LoadTestMappingName: pulumi.String("myLoadTestMapping"),
* ResourceUri: pulumi.String("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.Web/sites/sitename"),
* SourceResourceId: pulumi.String("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.Web/sites/sitename"),
* TestId: pulumi.String("123456"),
* })
* 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.azurenative.loadtestservice.LoadTestMapping;
* import com.pulumi.azurenative.loadtestservice.LoadTestMappingArgs;
* 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 loadTestMapping = new LoadTestMapping("loadTestMapping", LoadTestMappingArgs.builder()
* .azureLoadTestingResourceId("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.LoadTestService/loadTests/myLoadTest")
* .loadTestMappingName("myLoadTestMapping")
* .resourceUri("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.Web/sites/sitename")
* .sourceResourceId("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.Web/sites/sitename")
* .testId("123456")
* .build());
* }
* }
* ```
* ## Import
* An existing resource can be imported using its type token, name, and identifier, e.g.
* ```sh
* $ pulumi import azure-native:loadtestservice:LoadTestMapping myLoadTestMapping /{resourceUri}/providers/Microsoft.LoadTestService/loadTestMappings/{loadTestMappingName}
* ```
*/
public class LoadTestMapping internal constructor(
override val javaResource: com.pulumi.azurenative.loadtestservice.LoadTestMapping,
) : KotlinCustomResource(javaResource, LoadTestMappingMapper) {
/**
* Mapped Azure Load Test resource Id.
*/
public val azureLoadTestingResourceId: Output?
get() = javaResource.azureLoadTestingResourceId().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The name of the resource
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* Mapped source resource Id.
*/
public val sourceResourceId: Output?
get() = javaResource.sourceResourceId().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Azure Resource Manager metadata containing createdBy and modifiedBy information.
*/
public val systemData: Output
get() = javaResource.systemData().applyValue({ args0 -> args0.let({ args0 -> toKotlin(args0) }) })
/**
* Mapped Azure Load Test resource test-id.
*/
public val testId: Output?
get() = javaResource.testId().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
*/
public val type: Output
get() = javaResource.type().applyValue({ args0 -> args0 })
}
public object LoadTestMappingMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azurenative.loadtestservice.LoadTestMapping::class == javaResource::class
override fun map(javaResource: Resource): LoadTestMapping = LoadTestMapping(
javaResource as
com.pulumi.azurenative.loadtestservice.LoadTestMapping,
)
}
/**
* @see [LoadTestMapping].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [LoadTestMapping].
*/
public suspend fun loadTestMapping(
name: String,
block: suspend LoadTestMappingResourceBuilder.() -> Unit,
): LoadTestMapping {
val builder = LoadTestMappingResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [LoadTestMapping].
* @param name The _unique_ name of the resulting resource.
*/
public fun loadTestMapping(name: String): LoadTestMapping {
val builder = LoadTestMappingResourceBuilder()
builder.name(name)
return builder.build()
}