![JAR search and dependency download from the Maven repository](/logo.png)
com.pulumi.azurenative.compute.kotlin.VirtualMachineScaleSetVMRunCommand.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-azure-native-kotlin Show documentation
Show all versions of pulumi-azure-native-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azurenative.compute.kotlin
import com.pulumi.azurenative.compute.kotlin.outputs.RunCommandInputParameterResponse
import com.pulumi.azurenative.compute.kotlin.outputs.RunCommandManagedIdentityResponse
import com.pulumi.azurenative.compute.kotlin.outputs.VirtualMachineRunCommandInstanceViewResponse
import com.pulumi.azurenative.compute.kotlin.outputs.VirtualMachineRunCommandScriptSourceResponse
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.azurenative.compute.kotlin.outputs.RunCommandInputParameterResponse.Companion.toKotlin as runCommandInputParameterResponseToKotlin
import com.pulumi.azurenative.compute.kotlin.outputs.RunCommandManagedIdentityResponse.Companion.toKotlin as runCommandManagedIdentityResponseToKotlin
import com.pulumi.azurenative.compute.kotlin.outputs.VirtualMachineRunCommandInstanceViewResponse.Companion.toKotlin as virtualMachineRunCommandInstanceViewResponseToKotlin
import com.pulumi.azurenative.compute.kotlin.outputs.VirtualMachineRunCommandScriptSourceResponse.Companion.toKotlin as virtualMachineRunCommandScriptSourceResponseToKotlin
/**
* Builder for [VirtualMachineScaleSetVMRunCommand].
*/
@PulumiTagMarker
public class VirtualMachineScaleSetVMRunCommandResourceBuilder internal constructor() {
public var name: String? = null
public var args: VirtualMachineScaleSetVMRunCommandArgs = VirtualMachineScaleSetVMRunCommandArgs()
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 VirtualMachineScaleSetVMRunCommandArgsBuilder.() -> Unit) {
val builder = VirtualMachineScaleSetVMRunCommandArgsBuilder()
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(): VirtualMachineScaleSetVMRunCommand {
val builtJavaResource =
com.pulumi.azurenative.compute.VirtualMachineScaleSetVMRunCommand(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return VirtualMachineScaleSetVMRunCommand(builtJavaResource)
}
}
/**
* Describes a Virtual Machine run command.
* Azure REST API version: 2023-03-01. Prior API version in Azure Native 1.x: 2021-03-01.
* Other available API versions: 2023-07-01, 2023-09-01, 2024-03-01, 2024-07-01.
* ## Example Usage
* ### Create VirtualMachineScaleSet VM run command.
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using AzureNative = Pulumi.AzureNative;
* return await Deployment.RunAsync(() =>
* {
* var virtualMachineScaleSetVMRunCommand = new AzureNative.Compute.VirtualMachineScaleSetVMRunCommand("virtualMachineScaleSetVMRunCommand", new()
* {
* AsyncExecution = false,
* ErrorBlobManagedIdentity = null,
* ErrorBlobUri = "https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt",
* InstanceId = "0",
* Location = "West US",
* OutputBlobManagedIdentity = new AzureNative.Compute.Inputs.RunCommandManagedIdentityArgs
* {
* ClientId = "22d35efb-0c99-4041-8c5b-6d24db33a69a",
* },
* OutputBlobUri = "https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt",
* Parameters = new[]
* {
* new AzureNative.Compute.Inputs.RunCommandInputParameterArgs
* {
* Name = "param1",
* Value = "value1",
* },
* new AzureNative.Compute.Inputs.RunCommandInputParameterArgs
* {
* Name = "param2",
* Value = "value2",
* },
* },
* ResourceGroupName = "myResourceGroup",
* RunAsPassword = "",
* RunAsUser = "user1",
* RunCommandName = "myRunCommand",
* Source = new AzureNative.Compute.Inputs.VirtualMachineRunCommandScriptSourceArgs
* {
* ScriptUri = "https://mystorageaccount.blob.core.windows.net/scriptcontainer/MyScript.ps1",
* ScriptUriManagedIdentity = new AzureNative.Compute.Inputs.RunCommandManagedIdentityArgs
* {
* ObjectId = "4231e4d2-33e4-4e23-96b2-17888afa6072",
* },
* },
* TimeoutInSeconds = 3600,
* TreatFailureAsDeploymentFailure = true,
* VmScaleSetName = "myvmScaleSet",
* });
* });
* ```
* ```go
* package main
* import (
* compute "github.com/pulumi/pulumi-azure-native-sdk/compute/v2"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := compute.NewVirtualMachineScaleSetVMRunCommand(ctx, "virtualMachineScaleSetVMRunCommand", &compute.VirtualMachineScaleSetVMRunCommandArgs{
* AsyncExecution: pulumi.Bool(false),
* ErrorBlobManagedIdentity: nil,
* ErrorBlobUri: pulumi.String("https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt"),
* InstanceId: pulumi.String("0"),
* Location: pulumi.String("West US"),
* OutputBlobManagedIdentity: &compute.RunCommandManagedIdentityArgs{
* ClientId: pulumi.String("22d35efb-0c99-4041-8c5b-6d24db33a69a"),
* },
* OutputBlobUri: pulumi.String("https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt"),
* Parameters: compute.RunCommandInputParameterArray{
* &compute.RunCommandInputParameterArgs{
* Name: pulumi.String("param1"),
* Value: pulumi.String("value1"),
* },
* &compute.RunCommandInputParameterArgs{
* Name: pulumi.String("param2"),
* Value: pulumi.String("value2"),
* },
* },
* ResourceGroupName: pulumi.String("myResourceGroup"),
* RunAsPassword: pulumi.String(""),
* RunAsUser: pulumi.String("user1"),
* RunCommandName: pulumi.String("myRunCommand"),
* Source: &compute.VirtualMachineRunCommandScriptSourceArgs{
* ScriptUri: pulumi.String("https://mystorageaccount.blob.core.windows.net/scriptcontainer/MyScript.ps1"),
* ScriptUriManagedIdentity: &compute.RunCommandManagedIdentityArgs{
* ObjectId: pulumi.String("4231e4d2-33e4-4e23-96b2-17888afa6072"),
* },
* },
* TimeoutInSeconds: pulumi.Int(3600),
* TreatFailureAsDeploymentFailure: pulumi.Bool(true),
* VmScaleSetName: pulumi.String("myvmScaleSet"),
* })
* 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.compute.VirtualMachineScaleSetVMRunCommand;
* import com.pulumi.azurenative.compute.VirtualMachineScaleSetVMRunCommandArgs;
* import com.pulumi.azurenative.compute.inputs.RunCommandManagedIdentityArgs;
* import com.pulumi.azurenative.compute.inputs.RunCommandInputParameterArgs;
* import com.pulumi.azurenative.compute.inputs.VirtualMachineRunCommandScriptSourceArgs;
* 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 virtualMachineScaleSetVMRunCommand = new VirtualMachineScaleSetVMRunCommand("virtualMachineScaleSetVMRunCommand", VirtualMachineScaleSetVMRunCommandArgs.builder()
* .asyncExecution(false)
* .errorBlobManagedIdentity()
* .errorBlobUri("https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt")
* .instanceId("0")
* .location("West US")
* .outputBlobManagedIdentity(RunCommandManagedIdentityArgs.builder()
* .clientId("22d35efb-0c99-4041-8c5b-6d24db33a69a")
* .build())
* .outputBlobUri("https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt")
* .parameters(
* RunCommandInputParameterArgs.builder()
* .name("param1")
* .value("value1")
* .build(),
* RunCommandInputParameterArgs.builder()
* .name("param2")
* .value("value2")
* .build())
* .resourceGroupName("myResourceGroup")
* .runAsPassword("")
* .runAsUser("user1")
* .runCommandName("myRunCommand")
* .source(VirtualMachineRunCommandScriptSourceArgs.builder()
* .scriptUri("https://mystorageaccount.blob.core.windows.net/scriptcontainer/MyScript.ps1")
* .scriptUriManagedIdentity(RunCommandManagedIdentityArgs.builder()
* .objectId("4231e4d2-33e4-4e23-96b2-17888afa6072")
* .build())
* .build())
* .timeoutInSeconds(3600)
* .treatFailureAsDeploymentFailure(true)
* .vmScaleSetName("myvmScaleSet")
* .build());
* }
* }
* ```
* ## Import
* An existing resource can be imported using its type token, name, and identifier, e.g.
* ```sh
* $ pulumi import azure-native:compute:VirtualMachineScaleSetVMRunCommand myRunCommand /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}
* ```
*/
public class VirtualMachineScaleSetVMRunCommand internal constructor(
override val javaResource: com.pulumi.azurenative.compute.VirtualMachineScaleSetVMRunCommand,
) : KotlinCustomResource(javaResource, VirtualMachineScaleSetVMRunCommandMapper) {
/**
* Optional. If set to true, provisioning will complete as soon as the script starts and will not wait for script to complete.
*/
public val asyncExecution: Output?
get() = javaResource.asyncExecution().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* User-assigned managed identity that has access to errorBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure managed identity has been given access to blob's container with 'Storage Blob Data Contributor' role assignment. In case of user-assigned identity, make sure you add it under VM's identity. For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged
*/
public val errorBlobManagedIdentity: Output?
get() = javaResource.errorBlobManagedIdentity().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> runCommandManagedIdentityResponseToKotlin(args0) })
}).orElse(null)
})
/**
* Specifies the Azure storage blob where script error stream will be uploaded. Use a SAS URI with read, append, create, write access OR use managed identity to provide the VM access to the blob. Refer errorBlobManagedIdentity parameter.
*/
public val errorBlobUri: Output?
get() = javaResource.errorBlobUri().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The virtual machine run command instance view.
*/
public val instanceView: Output
get() = javaResource.instanceView().applyValue({ args0 ->
args0.let({ args0 ->
virtualMachineRunCommandInstanceViewResponseToKotlin(args0)
})
})
/**
* Resource location
*/
public val location: Output
get() = javaResource.location().applyValue({ args0 -> args0 })
/**
* Resource name
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* User-assigned managed identity that has access to outputBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure managed identity has been given access to blob's container with 'Storage Blob Data Contributor' role assignment. In case of user-assigned identity, make sure you add it under VM's identity. For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged
*/
public val outputBlobManagedIdentity: Output?
get() = javaResource.outputBlobManagedIdentity().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> runCommandManagedIdentityResponseToKotlin(args0) })
}).orElse(null)
})
/**
* Specifies the Azure storage blob where script output stream will be uploaded. Use a SAS URI with read, append, create, write access OR use managed identity to provide the VM access to the blob. Refer outputBlobManagedIdentity parameter.
*/
public val outputBlobUri: Output?
get() = javaResource.outputBlobUri().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The parameters used by the script.
*/
public val parameters: Output>?
get() = javaResource.parameters().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> runCommandInputParameterResponseToKotlin(args0) })
})
}).orElse(null)
})
/**
* The parameters used by the script.
*/
public val protectedParameters: Output>?
get() = javaResource.protectedParameters().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
runCommandInputParameterResponseToKotlin(args0)
})
})
}).orElse(null)
})
/**
* The provisioning state, which only appears in the response. If treatFailureAsDeploymentFailure set to true, any failure in the script will fail the deployment and ProvisioningState will be marked as Failed. If treatFailureAsDeploymentFailure set to false, ProvisioningState would only reflect whether the run command was run or not by the extensions platform, it would not indicate whether script failed in case of script failures. See instance view of run command in case of script failures to see executionMessage, output, error: https://aka.ms/runcommandmanaged#get-execution-status-and-results
*/
public val provisioningState: Output
get() = javaResource.provisioningState().applyValue({ args0 -> args0 })
/**
* Specifies the user account password on the VM when executing the run command.
*/
public val runAsPassword: Output?
get() = javaResource.runAsPassword().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Specifies the user account on the VM when executing the run command.
*/
public val runAsUser: Output?
get() = javaResource.runAsUser().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* The source of the run command script.
*/
public val source: Output?
get() = javaResource.source().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
virtualMachineRunCommandScriptSourceResponseToKotlin(args0)
})
}).orElse(null)
})
/**
* Resource tags
*/
public val tags: Output
© 2015 - 2025 Weber Informatics LLC | Privacy Policy