com.pulumi.azurenative.compute.VirtualMachineRunCommandByVirtualMachine Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-native Show documentation
Show all versions of azure-native Show documentation
A native Pulumi package for creating and managing Azure resources.
The newest version!
// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package com.pulumi.azurenative.compute;
import com.pulumi.azurenative.Utilities;
import com.pulumi.azurenative.compute.VirtualMachineRunCommandByVirtualMachineArgs;
import com.pulumi.azurenative.compute.outputs.RunCommandInputParameterResponse;
import com.pulumi.azurenative.compute.outputs.RunCommandManagedIdentityResponse;
import com.pulumi.azurenative.compute.outputs.VirtualMachineRunCommandInstanceViewResponse;
import com.pulumi.azurenative.compute.outputs.VirtualMachineRunCommandScriptSourceResponse;
import com.pulumi.core.Alias;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.Boolean;
import java.lang.Integer;
import java.lang.String;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* 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 or update a run command.
*
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azurenative.compute.VirtualMachineRunCommandByVirtualMachine;
* import com.pulumi.azurenative.compute.VirtualMachineRunCommandByVirtualMachineArgs;
* 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 virtualMachineRunCommandByVirtualMachine = new VirtualMachineRunCommandByVirtualMachine("virtualMachineRunCommandByVirtualMachine", VirtualMachineRunCommandByVirtualMachineArgs.builder()
* .asyncExecution(false)
* .errorBlobUri("https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt?sp=racw&st=2022-10-07T19:40:21Z&se=2022-10-08T03:40:21Z&spr=https&sv=2021-06-08&sr=b&sig=Yh7B%2Fy83olbYBdfsfbUREvd7ol8Dq5EVP3lAO4Kj4xDcN8%3D")
* .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?sp=r&st=2022-10-07T19:52:54Z&se=2022-10-08T03:52:54Z&spr=https&sv=2021-06-08&sr=b&sig=zfYFYCgea1PqVERZuwJiewrte5gjTnKGtVJngcw5oc828%3D")
* .build())
* .timeoutInSeconds(3600)
* .treatFailureAsDeploymentFailure(false)
* .vmName("myVM")
* .build());
*
* }
* }
*
* }
*
*
* ## Import
*
* An existing resource can be imported using its type token, name, and identifier, e.g.
*
* ```sh
* $ pulumi import azure-native:compute:VirtualMachineRunCommandByVirtualMachine myRunCommand /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}
* ```
*
*/
@ResourceType(type="azure-native:compute:VirtualMachineRunCommandByVirtualMachine")
public class VirtualMachineRunCommandByVirtualMachine extends com.pulumi.resources.CustomResource {
/**
* Optional. If set to true, provisioning will complete as soon as the script starts and will not wait for script to complete.
*
*/
@Export(name="asyncExecution", refs={Boolean.class}, tree="[0]")
private Output* @Nullable */ Boolean> asyncExecution;
/**
* @return Optional. If set to true, provisioning will complete as soon as the script starts and will not wait for script to complete.
*
*/
public Output> asyncExecution() {
return Codegen.optional(this.asyncExecution);
}
/**
* 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
*
*/
@Export(name="errorBlobManagedIdentity", refs={RunCommandManagedIdentityResponse.class}, tree="[0]")
private Output* @Nullable */ RunCommandManagedIdentityResponse> errorBlobManagedIdentity;
/**
* @return 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 Output> errorBlobManagedIdentity() {
return Codegen.optional(this.errorBlobManagedIdentity);
}
/**
* 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.
*
*/
@Export(name="errorBlobUri", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> errorBlobUri;
/**
* @return 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 Output> errorBlobUri() {
return Codegen.optional(this.errorBlobUri);
}
/**
* The virtual machine run command instance view.
*
*/
@Export(name="instanceView", refs={VirtualMachineRunCommandInstanceViewResponse.class}, tree="[0]")
private Output instanceView;
/**
* @return The virtual machine run command instance view.
*
*/
public Output instanceView() {
return this.instanceView;
}
/**
* Resource location
*
*/
@Export(name="location", refs={String.class}, tree="[0]")
private Output location;
/**
* @return Resource location
*
*/
public Output location() {
return this.location;
}
/**
* Resource name
*
*/
@Export(name="name", refs={String.class}, tree="[0]")
private Output name;
/**
* @return Resource name
*
*/
public Output name() {
return this.name;
}
/**
* 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
*
*/
@Export(name="outputBlobManagedIdentity", refs={RunCommandManagedIdentityResponse.class}, tree="[0]")
private Output* @Nullable */ RunCommandManagedIdentityResponse> outputBlobManagedIdentity;
/**
* @return 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 Output> outputBlobManagedIdentity() {
return Codegen.optional(this.outputBlobManagedIdentity);
}
/**
* 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.
*
*/
@Export(name="outputBlobUri", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> outputBlobUri;
/**
* @return 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 Output> outputBlobUri() {
return Codegen.optional(this.outputBlobUri);
}
/**
* The parameters used by the script.
*
*/
@Export(name="parameters", refs={List.class,RunCommandInputParameterResponse.class}, tree="[0,1]")
private Output* @Nullable */ List> parameters;
/**
* @return The parameters used by the script.
*
*/
public Output>> parameters() {
return Codegen.optional(this.parameters);
}
/**
* The parameters used by the script.
*
*/
@Export(name="protectedParameters", refs={List.class,RunCommandInputParameterResponse.class}, tree="[0,1]")
private Output* @Nullable */ List> protectedParameters;
/**
* @return The parameters used by the script.
*
*/
public Output>> protectedParameters() {
return Codegen.optional(this.protectedParameters);
}
/**
* 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
*
*/
@Export(name="provisioningState", refs={String.class}, tree="[0]")
private Output provisioningState;
/**
* @return 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 Output provisioningState() {
return this.provisioningState;
}
/**
* Specifies the user account password on the VM when executing the run command.
*
*/
@Export(name="runAsPassword", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> runAsPassword;
/**
* @return Specifies the user account password on the VM when executing the run command.
*
*/
public Output> runAsPassword() {
return Codegen.optional(this.runAsPassword);
}
/**
* Specifies the user account on the VM when executing the run command.
*
*/
@Export(name="runAsUser", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> runAsUser;
/**
* @return Specifies the user account on the VM when executing the run command.
*
*/
public Output> runAsUser() {
return Codegen.optional(this.runAsUser);
}
/**
* The source of the run command script.
*
*/
@Export(name="source", refs={VirtualMachineRunCommandScriptSourceResponse.class}, tree="[0]")
private Output* @Nullable */ VirtualMachineRunCommandScriptSourceResponse> source;
/**
* @return The source of the run command script.
*
*/
public Output> source() {
return Codegen.optional(this.source);
}
/**
* Resource tags
*
*/
@Export(name="tags", refs={Map.class,String.class}, tree="[0,1,1]")
private Output* @Nullable */ Map> tags;
/**
* @return Resource tags
*
*/
public Output>> tags() {
return Codegen.optional(this.tags);
}
/**
* The timeout in seconds to execute the run command.
*
*/
@Export(name="timeoutInSeconds", refs={Integer.class}, tree="[0]")
private Output* @Nullable */ Integer> timeoutInSeconds;
/**
* @return The timeout in seconds to execute the run command.
*
*/
public Output> timeoutInSeconds() {
return Codegen.optional(this.timeoutInSeconds);
}
/**
* Optional. If set to true, any failure in the script will fail the deployment and ProvisioningState will be marked as Failed. If 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
*
*/
@Export(name="treatFailureAsDeploymentFailure", refs={Boolean.class}, tree="[0]")
private Output* @Nullable */ Boolean> treatFailureAsDeploymentFailure;
/**
* @return Optional. If set to true, any failure in the script will fail the deployment and ProvisioningState will be marked as Failed. If 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 Output> treatFailureAsDeploymentFailure() {
return Codegen.optional(this.treatFailureAsDeploymentFailure);
}
/**
* Resource type
*
*/
@Export(name="type", refs={String.class}, tree="[0]")
private Output type;
/**
* @return Resource type
*
*/
public Output type() {
return this.type;
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public VirtualMachineRunCommandByVirtualMachine(java.lang.String name) {
this(name, VirtualMachineRunCommandByVirtualMachineArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public VirtualMachineRunCommandByVirtualMachine(java.lang.String name, VirtualMachineRunCommandByVirtualMachineArgs args) {
this(name, args, null);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
* @param options A bag of options that control this resource's behavior.
*/
public VirtualMachineRunCommandByVirtualMachine(java.lang.String name, VirtualMachineRunCommandByVirtualMachineArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure-native:compute:VirtualMachineRunCommandByVirtualMachine", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private VirtualMachineRunCommandByVirtualMachine(java.lang.String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure-native:compute:VirtualMachineRunCommandByVirtualMachine", name, null, makeResourceOptions(options, id), false);
}
private static VirtualMachineRunCommandByVirtualMachineArgs makeArgs(VirtualMachineRunCommandByVirtualMachineArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? VirtualMachineRunCommandByVirtualMachineArgs.Empty : args;
}
private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) {
var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder()
.version(Utilities.getVersion())
.aliases(List.of(
Output.of(Alias.builder().type("azure-native:compute/v20200601:VirtualMachineRunCommandByVirtualMachine").build()),
Output.of(Alias.builder().type("azure-native:compute/v20201201:VirtualMachineRunCommandByVirtualMachine").build()),
Output.of(Alias.builder().type("azure-native:compute/v20210301:VirtualMachineRunCommandByVirtualMachine").build()),
Output.of(Alias.builder().type("azure-native:compute/v20210401:VirtualMachineRunCommandByVirtualMachine").build()),
Output.of(Alias.builder().type("azure-native:compute/v20210701:VirtualMachineRunCommandByVirtualMachine").build()),
Output.of(Alias.builder().type("azure-native:compute/v20211101:VirtualMachineRunCommandByVirtualMachine").build()),
Output.of(Alias.builder().type("azure-native:compute/v20220301:VirtualMachineRunCommandByVirtualMachine").build()),
Output.of(Alias.builder().type("azure-native:compute/v20220801:VirtualMachineRunCommandByVirtualMachine").build()),
Output.of(Alias.builder().type("azure-native:compute/v20221101:VirtualMachineRunCommandByVirtualMachine").build()),
Output.of(Alias.builder().type("azure-native:compute/v20230301:VirtualMachineRunCommandByVirtualMachine").build()),
Output.of(Alias.builder().type("azure-native:compute/v20230701:VirtualMachineRunCommandByVirtualMachine").build()),
Output.of(Alias.builder().type("azure-native:compute/v20230901:VirtualMachineRunCommandByVirtualMachine").build()),
Output.of(Alias.builder().type("azure-native:compute/v20240301:VirtualMachineRunCommandByVirtualMachine").build()),
Output.of(Alias.builder().type("azure-native:compute/v20240701:VirtualMachineRunCommandByVirtualMachine").build())
))
.build();
return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id);
}
/**
* Get an existing Host resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param options Optional settings to control the behavior of the CustomResource.
*/
public static VirtualMachineRunCommandByVirtualMachine get(java.lang.String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new VirtualMachineRunCommandByVirtualMachine(name, id, options);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy