Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.azure.chaosstudio.kotlin.Experiment.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.chaosstudio.kotlin
import com.pulumi.azure.chaosstudio.kotlin.outputs.ExperimentIdentity
import com.pulumi.azure.chaosstudio.kotlin.outputs.ExperimentSelector
import com.pulumi.azure.chaosstudio.kotlin.outputs.ExperimentStep
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
import kotlin.collections.List
import com.pulumi.azure.chaosstudio.kotlin.outputs.ExperimentIdentity.Companion.toKotlin as experimentIdentityToKotlin
import com.pulumi.azure.chaosstudio.kotlin.outputs.ExperimentSelector.Companion.toKotlin as experimentSelectorToKotlin
import com.pulumi.azure.chaosstudio.kotlin.outputs.ExperimentStep.Companion.toKotlin as experimentStepToKotlin
/**
* Builder for [Experiment].
*/
@PulumiTagMarker
public class ExperimentResourceBuilder internal constructor() {
public var name: String? = null
public var args: ExperimentArgs = ExperimentArgs()
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 ExperimentArgsBuilder.() -> Unit) {
val builder = ExperimentArgsBuilder()
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(): Experiment {
val builtJavaResource = com.pulumi.azure.chaosstudio.Experiment(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Experiment(builtJavaResource)
}
}
/**
* Manages a Chaos Studio Experiment.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* const example = new azure.core.ResourceGroup("example", {
* name: "example",
* location: "westeurope",
* });
* const exampleUserAssignedIdentity = new azure.authorization.UserAssignedIdentity("example", {
* resourceGroupName: example.name,
* location: example.location,
* name: "example",
* });
* const exampleVirtualNetwork = new azure.network.VirtualNetwork("example", {
* name: "example",
* addressSpaces: ["10.0.0.0/16"],
* location: example.location,
* resourceGroupName: example.name,
* });
* const exampleSubnet = new azure.network.Subnet("example", {
* name: "internal",
* resourceGroupName: example.name,
* virtualNetworkName: exampleVirtualNetwork.name,
* addressPrefixes: ["10.0.2.0/24"],
* });
* const exampleNetworkInterface = new azure.network.NetworkInterface("example", {
* name: "example",
* location: example.location,
* resourceGroupName: example.name,
* ipConfigurations: [{
* name: "example",
* subnetId: exampleSubnet.id,
* privateIpAddressAllocation: "Dynamic",
* }],
* });
* const exampleLinuxVirtualMachine = new azure.compute.LinuxVirtualMachine("example", {
* name: "example",
* resourceGroupName: example.name,
* location: example.location,
* size: "Standard_F2",
* adminUsername: "adminuser",
* adminPassword: "example",
* disablePasswordAuthentication: false,
* networkInterfaceIds: [exampleNetworkInterface.id],
* osDisk: {
* caching: "ReadWrite",
* storageAccountType: "Standard_LRS",
* },
* sourceImageReference: {
* publisher: "Canonical",
* offer: "0001-com-ubuntu-server-jammy",
* sku: "22_04-lts",
* version: "latest",
* },
* });
* const exampleTarget = new azure.chaosstudio.Target("example", {
* location: example.location,
* targetResourceId: exampleLinuxVirtualMachine.id,
* targetType: "Microsoft-VirtualMachine",
* });
* const exampleCapability = new azure.chaosstudio.Capability("example", {
* chaosStudioTargetId: exampleTarget.id,
* capabilityType: "Shutdown-1.0",
* });
* const exampleExperiment = new azure.chaosstudio.Experiment("example", {
* location: example.location,
* name: "example",
* resourceGroupName: example.name,
* identity: {
* type: "SystemAssigned",
* },
* selectors: [{
* name: "Selector1",
* chaosStudioTargetIds: [exampleTarget.id],
* }],
* steps: [{
* name: "example",
* branches: [{
* name: "example",
* actions: [{
* urn: exampleCapability.capabilityUrn,
* selectorName: "Selector1",
* parameters: {
* abruptShutdown: "false",
* },
* actionType: "continuous",
* duration: "PT10M",
* }],
* }],
* }],
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* example = azure.core.ResourceGroup("example",
* name="example",
* location="westeurope")
* example_user_assigned_identity = azure.authorization.UserAssignedIdentity("example",
* resource_group_name=example.name,
* location=example.location,
* name="example")
* example_virtual_network = azure.network.VirtualNetwork("example",
* name="example",
* address_spaces=["10.0.0.0/16"],
* location=example.location,
* resource_group_name=example.name)
* example_subnet = azure.network.Subnet("example",
* name="internal",
* resource_group_name=example.name,
* virtual_network_name=example_virtual_network.name,
* address_prefixes=["10.0.2.0/24"])
* example_network_interface = azure.network.NetworkInterface("example",
* name="example",
* location=example.location,
* resource_group_name=example.name,
* ip_configurations=[{
* "name": "example",
* "subnet_id": example_subnet.id,
* "private_ip_address_allocation": "Dynamic",
* }])
* example_linux_virtual_machine = azure.compute.LinuxVirtualMachine("example",
* name="example",
* resource_group_name=example.name,
* location=example.location,
* size="Standard_F2",
* admin_username="adminuser",
* admin_password="example",
* disable_password_authentication=False,
* network_interface_ids=[example_network_interface.id],
* os_disk={
* "caching": "ReadWrite",
* "storage_account_type": "Standard_LRS",
* },
* source_image_reference={
* "publisher": "Canonical",
* "offer": "0001-com-ubuntu-server-jammy",
* "sku": "22_04-lts",
* "version": "latest",
* })
* example_target = azure.chaosstudio.Target("example",
* location=example.location,
* target_resource_id=example_linux_virtual_machine.id,
* target_type="Microsoft-VirtualMachine")
* example_capability = azure.chaosstudio.Capability("example",
* chaos_studio_target_id=example_target.id,
* capability_type="Shutdown-1.0")
* example_experiment = azure.chaosstudio.Experiment("example",
* location=example.location,
* name="example",
* resource_group_name=example.name,
* identity={
* "type": "SystemAssigned",
* },
* selectors=[{
* "name": "Selector1",
* "chaos_studio_target_ids": [example_target.id],
* }],
* steps=[{
* "name": "example",
* "branches": [{
* "name": "example",
* "actions": [{
* "urn": example_capability.capability_urn,
* "selector_name": "Selector1",
* "parameters": {
* "abrupt_shutdown": "false",
* },
* "action_type": "continuous",
* "duration": "PT10M",
* }],
* }],
* }])
* ```
* ```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",
* Location = "westeurope",
* });
* var exampleUserAssignedIdentity = new Azure.Authorization.UserAssignedIdentity("example", new()
* {
* ResourceGroupName = example.Name,
* Location = example.Location,
* Name = "example",
* });
* var exampleVirtualNetwork = new Azure.Network.VirtualNetwork("example", new()
* {
* Name = "example",
* AddressSpaces = new[]
* {
* "10.0.0.0/16",
* },
* Location = example.Location,
* ResourceGroupName = example.Name,
* });
* var exampleSubnet = new Azure.Network.Subnet("example", new()
* {
* Name = "internal",
* ResourceGroupName = example.Name,
* VirtualNetworkName = exampleVirtualNetwork.Name,
* AddressPrefixes = new[]
* {
* "10.0.2.0/24",
* },
* });
* var exampleNetworkInterface = new Azure.Network.NetworkInterface("example", new()
* {
* Name = "example",
* Location = example.Location,
* ResourceGroupName = example.Name,
* IpConfigurations = new[]
* {
* new Azure.Network.Inputs.NetworkInterfaceIpConfigurationArgs
* {
* Name = "example",
* SubnetId = exampleSubnet.Id,
* PrivateIpAddressAllocation = "Dynamic",
* },
* },
* });
* var exampleLinuxVirtualMachine = new Azure.Compute.LinuxVirtualMachine("example", new()
* {
* Name = "example",
* ResourceGroupName = example.Name,
* Location = example.Location,
* Size = "Standard_F2",
* AdminUsername = "adminuser",
* AdminPassword = "example",
* DisablePasswordAuthentication = false,
* NetworkInterfaceIds = new[]
* {
* exampleNetworkInterface.Id,
* },
* OsDisk = new Azure.Compute.Inputs.LinuxVirtualMachineOsDiskArgs
* {
* Caching = "ReadWrite",
* StorageAccountType = "Standard_LRS",
* },
* SourceImageReference = new Azure.Compute.Inputs.LinuxVirtualMachineSourceImageReferenceArgs
* {
* Publisher = "Canonical",
* Offer = "0001-com-ubuntu-server-jammy",
* Sku = "22_04-lts",
* Version = "latest",
* },
* });
* var exampleTarget = new Azure.ChaosStudio.Target("example", new()
* {
* Location = example.Location,
* TargetResourceId = exampleLinuxVirtualMachine.Id,
* TargetType = "Microsoft-VirtualMachine",
* });
* var exampleCapability = new Azure.ChaosStudio.Capability("example", new()
* {
* ChaosStudioTargetId = exampleTarget.Id,
* CapabilityType = "Shutdown-1.0",
* });
* var exampleExperiment = new Azure.ChaosStudio.Experiment("example", new()
* {
* Location = example.Location,
* Name = "example",
* ResourceGroupName = example.Name,
* Identity = new Azure.ChaosStudio.Inputs.ExperimentIdentityArgs
* {
* Type = "SystemAssigned",
* },
* Selectors = new[]
* {
* new Azure.ChaosStudio.Inputs.ExperimentSelectorArgs
* {
* Name = "Selector1",
* ChaosStudioTargetIds = new[]
* {
* exampleTarget.Id,
* },
* },
* },
* Steps = new[]
* {
* new Azure.ChaosStudio.Inputs.ExperimentStepArgs
* {
* Name = "example",
* Branches = new[]
* {
* new Azure.ChaosStudio.Inputs.ExperimentStepBranchArgs
* {
* Name = "example",
* Actions = new[]
* {
* new Azure.ChaosStudio.Inputs.ExperimentStepBranchActionArgs
* {
* Urn = exampleCapability.CapabilityUrn,
* SelectorName = "Selector1",
* Parameters =
* {
* { "abruptShutdown", "false" },
* },
* ActionType = "continuous",
* Duration = "PT10M",
* },
* },
* },
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/authorization"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/chaosstudio"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/compute"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/network"
* "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"),
* Location: pulumi.String("westeurope"),
* })
* if err != nil {
* return err
* }
* _, err = authorization.NewUserAssignedIdentity(ctx, "example", &authorization.UserAssignedIdentityArgs{
* ResourceGroupName: example.Name,
* Location: example.Location,
* Name: pulumi.String("example"),
* })
* if err != nil {
* return err
* }
* exampleVirtualNetwork, err := network.NewVirtualNetwork(ctx, "example", &network.VirtualNetworkArgs{
* Name: pulumi.String("example"),
* AddressSpaces: pulumi.StringArray{
* pulumi.String("10.0.0.0/16"),
* },
* Location: example.Location,
* ResourceGroupName: example.Name,
* })
* if err != nil {
* return err
* }
* exampleSubnet, err := network.NewSubnet(ctx, "example", &network.SubnetArgs{
* Name: pulumi.String("internal"),
* ResourceGroupName: example.Name,
* VirtualNetworkName: exampleVirtualNetwork.Name,
* AddressPrefixes: pulumi.StringArray{
* pulumi.String("10.0.2.0/24"),
* },
* })
* if err != nil {
* return err
* }
* exampleNetworkInterface, err := network.NewNetworkInterface(ctx, "example", &network.NetworkInterfaceArgs{
* Name: pulumi.String("example"),
* Location: example.Location,
* ResourceGroupName: example.Name,
* IpConfigurations: network.NetworkInterfaceIpConfigurationArray{
* &network.NetworkInterfaceIpConfigurationArgs{
* Name: pulumi.String("example"),
* SubnetId: exampleSubnet.ID(),
* PrivateIpAddressAllocation: pulumi.String("Dynamic"),
* },
* },
* })
* if err != nil {
* return err
* }
* exampleLinuxVirtualMachine, err := compute.NewLinuxVirtualMachine(ctx, "example", &compute.LinuxVirtualMachineArgs{
* Name: pulumi.String("example"),
* ResourceGroupName: example.Name,
* Location: example.Location,
* Size: pulumi.String("Standard_F2"),
* AdminUsername: pulumi.String("adminuser"),
* AdminPassword: pulumi.String("example"),
* DisablePasswordAuthentication: pulumi.Bool(false),
* NetworkInterfaceIds: pulumi.StringArray{
* exampleNetworkInterface.ID(),
* },
* OsDisk: &compute.LinuxVirtualMachineOsDiskArgs{
* Caching: pulumi.String("ReadWrite"),
* StorageAccountType: pulumi.String("Standard_LRS"),
* },
* SourceImageReference: &compute.LinuxVirtualMachineSourceImageReferenceArgs{
* Publisher: pulumi.String("Canonical"),
* Offer: pulumi.String("0001-com-ubuntu-server-jammy"),
* Sku: pulumi.String("22_04-lts"),
* Version: pulumi.String("latest"),
* },
* })
* if err != nil {
* return err
* }
* exampleTarget, err := chaosstudio.NewTarget(ctx, "example", &chaosstudio.TargetArgs{
* Location: example.Location,
* TargetResourceId: exampleLinuxVirtualMachine.ID(),
* TargetType: pulumi.String("Microsoft-VirtualMachine"),
* })
* if err != nil {
* return err
* }
* exampleCapability, err := chaosstudio.NewCapability(ctx, "example", &chaosstudio.CapabilityArgs{
* ChaosStudioTargetId: exampleTarget.ID(),
* CapabilityType: pulumi.String("Shutdown-1.0"),
* })
* if err != nil {
* return err
* }
* _, err = chaosstudio.NewExperiment(ctx, "example", &chaosstudio.ExperimentArgs{
* Location: example.Location,
* Name: pulumi.String("example"),
* ResourceGroupName: example.Name,
* Identity: &chaosstudio.ExperimentIdentityArgs{
* Type: pulumi.String("SystemAssigned"),
* },
* Selectors: chaosstudio.ExperimentSelectorArray{
* &chaosstudio.ExperimentSelectorArgs{
* Name: pulumi.String("Selector1"),
* ChaosStudioTargetIds: pulumi.StringArray{
* exampleTarget.ID(),
* },
* },
* },
* Steps: chaosstudio.ExperimentStepArray{
* &chaosstudio.ExperimentStepArgs{
* Name: pulumi.String("example"),
* Branches: chaosstudio.ExperimentStepBranchArray{
* &chaosstudio.ExperimentStepBranchArgs{
* Name: pulumi.String("example"),
* Actions: chaosstudio.ExperimentStepBranchActionArray{
* &chaosstudio.ExperimentStepBranchActionArgs{
* Urn: exampleCapability.CapabilityUrn,
* SelectorName: pulumi.String("Selector1"),
* Parameters: pulumi.StringMap{
* "abruptShutdown": pulumi.String("false"),
* },
* ActionType: pulumi.String("continuous"),
* Duration: pulumi.String("PT10M"),
* },
* },
* },
* },
* },
* },
* })
* 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.authorization.UserAssignedIdentity;
* import com.pulumi.azure.authorization.UserAssignedIdentityArgs;
* import com.pulumi.azure.network.VirtualNetwork;
* import com.pulumi.azure.network.VirtualNetworkArgs;
* import com.pulumi.azure.network.Subnet;
* import com.pulumi.azure.network.SubnetArgs;
* import com.pulumi.azure.network.NetworkInterface;
* import com.pulumi.azure.network.NetworkInterfaceArgs;
* import com.pulumi.azure.network.inputs.NetworkInterfaceIpConfigurationArgs;
* import com.pulumi.azure.compute.LinuxVirtualMachine;
* import com.pulumi.azure.compute.LinuxVirtualMachineArgs;
* import com.pulumi.azure.compute.inputs.LinuxVirtualMachineOsDiskArgs;
* import com.pulumi.azure.compute.inputs.LinuxVirtualMachineSourceImageReferenceArgs;
* import com.pulumi.azure.chaosstudio.Target;
* import com.pulumi.azure.chaosstudio.TargetArgs;
* import com.pulumi.azure.chaosstudio.Capability;
* import com.pulumi.azure.chaosstudio.CapabilityArgs;
* import com.pulumi.azure.chaosstudio.Experiment;
* import com.pulumi.azure.chaosstudio.ExperimentArgs;
* import com.pulumi.azure.chaosstudio.inputs.ExperimentIdentityArgs;
* import com.pulumi.azure.chaosstudio.inputs.ExperimentSelectorArgs;
* import com.pulumi.azure.chaosstudio.inputs.ExperimentStepArgs;
* 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")
* .location("westeurope")
* .build());
* var exampleUserAssignedIdentity = new UserAssignedIdentity("exampleUserAssignedIdentity", UserAssignedIdentityArgs.builder()
* .resourceGroupName(example.name())
* .location(example.location())
* .name("example")
* .build());
* var exampleVirtualNetwork = new VirtualNetwork("exampleVirtualNetwork", VirtualNetworkArgs.builder()
* .name("example")
* .addressSpaces("10.0.0.0/16")
* .location(example.location())
* .resourceGroupName(example.name())
* .build());
* var exampleSubnet = new Subnet("exampleSubnet", SubnetArgs.builder()
* .name("internal")
* .resourceGroupName(example.name())
* .virtualNetworkName(exampleVirtualNetwork.name())
* .addressPrefixes("10.0.2.0/24")
* .build());
* var exampleNetworkInterface = new NetworkInterface("exampleNetworkInterface", NetworkInterfaceArgs.builder()
* .name("example")
* .location(example.location())
* .resourceGroupName(example.name())
* .ipConfigurations(NetworkInterfaceIpConfigurationArgs.builder()
* .name("example")
* .subnetId(exampleSubnet.id())
* .privateIpAddressAllocation("Dynamic")
* .build())
* .build());
* var exampleLinuxVirtualMachine = new LinuxVirtualMachine("exampleLinuxVirtualMachine", LinuxVirtualMachineArgs.builder()
* .name("example")
* .resourceGroupName(example.name())
* .location(example.location())
* .size("Standard_F2")
* .adminUsername("adminuser")
* .adminPassword("example")
* .disablePasswordAuthentication(false)
* .networkInterfaceIds(exampleNetworkInterface.id())
* .osDisk(LinuxVirtualMachineOsDiskArgs.builder()
* .caching("ReadWrite")
* .storageAccountType("Standard_LRS")
* .build())
* .sourceImageReference(LinuxVirtualMachineSourceImageReferenceArgs.builder()
* .publisher("Canonical")
* .offer("0001-com-ubuntu-server-jammy")
* .sku("22_04-lts")
* .version("latest")
* .build())
* .build());
* var exampleTarget = new Target("exampleTarget", TargetArgs.builder()
* .location(example.location())
* .targetResourceId(exampleLinuxVirtualMachine.id())
* .targetType("Microsoft-VirtualMachine")
* .build());
* var exampleCapability = new Capability("exampleCapability", CapabilityArgs.builder()
* .chaosStudioTargetId(exampleTarget.id())
* .capabilityType("Shutdown-1.0")
* .build());
* var exampleExperiment = new Experiment("exampleExperiment", ExperimentArgs.builder()
* .location(example.location())
* .name("example")
* .resourceGroupName(example.name())
* .identity(ExperimentIdentityArgs.builder()
* .type("SystemAssigned")
* .build())
* .selectors(ExperimentSelectorArgs.builder()
* .name("Selector1")
* .chaosStudioTargetIds(exampleTarget.id())
* .build())
* .steps(ExperimentStepArgs.builder()
* .name("example")
* .branches(ExperimentStepBranchArgs.builder()
* .name("example")
* .actions(ExperimentStepBranchActionArgs.builder()
* .urn(exampleCapability.capabilityUrn())
* .selectorName("Selector1")
* .parameters(Map.of("abruptShutdown", "false"))
* .actionType("continuous")
* .duration("PT10M")
* .build())
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:core:ResourceGroup
* properties:
* name: example
* location: westeurope
* exampleUserAssignedIdentity:
* type: azure:authorization:UserAssignedIdentity
* name: example
* properties:
* resourceGroupName: ${example.name}
* location: ${example.location}
* name: example
* exampleVirtualNetwork:
* type: azure:network:VirtualNetwork
* name: example
* properties:
* name: example
* addressSpaces:
* - 10.0.0.0/16
* location: ${example.location}
* resourceGroupName: ${example.name}
* exampleSubnet:
* type: azure:network:Subnet
* name: example
* properties:
* name: internal
* resourceGroupName: ${example.name}
* virtualNetworkName: ${exampleVirtualNetwork.name}
* addressPrefixes:
* - 10.0.2.0/24
* exampleNetworkInterface:
* type: azure:network:NetworkInterface
* name: example
* properties:
* name: example
* location: ${example.location}
* resourceGroupName: ${example.name}
* ipConfigurations:
* - name: example
* subnetId: ${exampleSubnet.id}
* privateIpAddressAllocation: Dynamic
* exampleLinuxVirtualMachine:
* type: azure:compute:LinuxVirtualMachine
* name: example
* properties:
* name: example
* resourceGroupName: ${example.name}
* location: ${example.location}
* size: Standard_F2
* adminUsername: adminuser
* adminPassword: example
* disablePasswordAuthentication: false
* networkInterfaceIds:
* - ${exampleNetworkInterface.id}
* osDisk:
* caching: ReadWrite
* storageAccountType: Standard_LRS
* sourceImageReference:
* publisher: Canonical
* offer: 0001-com-ubuntu-server-jammy
* sku: 22_04-lts
* version: latest
* exampleTarget:
* type: azure:chaosstudio:Target
* name: example
* properties:
* location: ${example.location}
* targetResourceId: ${exampleLinuxVirtualMachine.id}
* targetType: Microsoft-VirtualMachine
* exampleCapability:
* type: azure:chaosstudio:Capability
* name: example
* properties:
* chaosStudioTargetId: ${exampleTarget.id}
* capabilityType: Shutdown-1.0
* exampleExperiment:
* type: azure:chaosstudio:Experiment
* name: example
* properties:
* location: ${example.location}
* name: example
* resourceGroupName: ${example.name}
* identity:
* type: SystemAssigned
* selectors:
* - name: Selector1
* chaosStudioTargetIds:
* - ${exampleTarget.id}
* steps:
* - name: example
* branches:
* - name: example
* actions:
* - urn: ${exampleCapability.capabilityUrn}
* selectorName: Selector1
* parameters:
* abruptShutdown: 'false'
* actionType: continuous
* duration: PT10M
* ```
*
* ## Import
* Chaos Studio Experiments can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:chaosstudio/experiment:Experiment example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Chaos/experiments/experiment1
* ```
*/
public class Experiment internal constructor(
override val javaResource: com.pulumi.azure.chaosstudio.Experiment,
) : KotlinCustomResource(javaResource, ExperimentMapper) {
/**
* A `identity` block as defined below.
*/
public val identity: Output?
get() = javaResource.identity().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
experimentIdentityToKotlin(args0)
})
}).orElse(null)
})
/**
* The Azure Region where the Chaos Studio Experiment should exist. Changing this forces a new Chaos Studio Experiment to be created.
*/
public val location: Output
get() = javaResource.location().applyValue({ args0 -> args0 })
/**
* The name which should be used for this Chaos Studio Experiment. Changing this forces a new Chaos Studio Experiment to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The name of the Resource Group where the Chaos Studio Experiment should exist. Changing this forces a new Chaos Studio Experiment to be created.
*/
public val resourceGroupName: Output
get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })
/**
* One or more `selectors` blocks as defined below.
*/
public val selectors: Output>
get() = javaResource.selectors().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
experimentSelectorToKotlin(args0)
})
})
})
/**
* One or more `steps` blocks as defined below.
*/
public val steps: Output>
get() = javaResource.steps().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
experimentStepToKotlin(args0)
})
})
})
}
public object ExperimentMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.chaosstudio.Experiment::class == javaResource::class
override fun map(javaResource: Resource): Experiment = Experiment(
javaResource as
com.pulumi.azure.chaosstudio.Experiment,
)
}
/**
* @see [Experiment].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [Experiment].
*/
public suspend fun experiment(name: String, block: suspend ExperimentResourceBuilder.() -> Unit): Experiment {
val builder = ExperimentResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [Experiment].
* @param name The _unique_ name of the resulting resource.
*/
public fun experiment(name: String): Experiment {
val builder = ExperimentResourceBuilder()
builder.name(name)
return builder.build()
}