Compartir a través de


VirtualMachineRunCommandScriptSource Class

  • java.lang.Object
    • com.azure.resourcemanager.compute.models.VirtualMachineRunCommandScriptSource

Implements

public final class VirtualMachineRunCommandScriptSource
implements JsonSerializable<VirtualMachineRunCommandScriptSource>

Describes the script sources for run command. Use only one of script, scriptUri, commandId.

Constructor Summary

Constructor Description
VirtualMachineRunCommandScriptSource()

Creates an instance of VirtualMachineRunCommandScriptSource class.

Method Summary

Modifier and Type Method and Description
String commandId()

Get the commandId property: Specifies a commandId of predefined built-in script.

static VirtualMachineRunCommandScriptSource fromJson(JsonReader jsonReader)

Reads an instance of VirtualMachineRunCommandScriptSource from the JsonReader.

String script()

Get the script property: Specifies the script content to be executed on the VM.

String scriptUri()

Get the scriptUri property: Specifies the script download location.

RunCommandManagedIdentity scriptUriManagedIdentity()

Get the scriptUriManagedIdentity property: User-assigned managed identity that has access to scriptUri in case of Azure storage blob.

JsonWriter toJson(JsonWriter jsonWriter)
void validate()

Validates the instance.

VirtualMachineRunCommandScriptSource withCommandId(String commandId)

Set the commandId property: Specifies a commandId of predefined built-in script.

VirtualMachineRunCommandScriptSource withScript(String script)

Set the script property: Specifies the script content to be executed on the VM.

VirtualMachineRunCommandScriptSource withScriptUri(String scriptUri)

Set the scriptUri property: Specifies the script download location.

VirtualMachineRunCommandScriptSource withScriptUriManagedIdentity(RunCommandManagedIdentity scriptUriManagedIdentity)

Set the scriptUriManagedIdentity property: User-assigned managed identity that has access to scriptUri in case of Azure storage blob.

Methods inherited from java.lang.Object

Constructor Details

VirtualMachineRunCommandScriptSource

public VirtualMachineRunCommandScriptSource()

Creates an instance of VirtualMachineRunCommandScriptSource class.

Method Details

commandId

public String commandId()

Get the commandId property: Specifies a commandId of predefined built-in script.

Returns:

the commandId value.

fromJson

public static VirtualMachineRunCommandScriptSource fromJson(JsonReader jsonReader)

Reads an instance of VirtualMachineRunCommandScriptSource from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of VirtualMachineRunCommandScriptSource if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.

Throws:

IOException

- If an error occurs while reading the VirtualMachineRunCommandScriptSource.

script

public String script()

Get the script property: Specifies the script content to be executed on the VM.

Returns:

the script value.

scriptUri

public String scriptUri()

Get the scriptUri property: Specifies the script download location. It can be either SAS URI of an Azure storage blob with read access or public URI.

Returns:

the scriptUri value.

scriptUriManagedIdentity

public RunCommandManagedIdentity scriptUriManagedIdentity()

Get the scriptUriManagedIdentity property: User-assigned managed identity that has access to scriptUri in case of Azure storage blob. Use an empty object in case of system-assigned identity. Make sure the Azure storage blob exists, and managed identity has been given access to blob's container with 'Storage Blob Data Reader' 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.

Returns:

the scriptUriManagedIdentity value.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

validate

public void validate()

Validates the instance.

withCommandId

public VirtualMachineRunCommandScriptSource withCommandId(String commandId)

Set the commandId property: Specifies a commandId of predefined built-in script.

Parameters:

commandId - the commandId value to set.

Returns:

the VirtualMachineRunCommandScriptSource object itself.

withScript

public VirtualMachineRunCommandScriptSource withScript(String script)

Set the script property: Specifies the script content to be executed on the VM.

Parameters:

script - the script value to set.

Returns:

the VirtualMachineRunCommandScriptSource object itself.

withScriptUri

public VirtualMachineRunCommandScriptSource withScriptUri(String scriptUri)

Set the scriptUri property: Specifies the script download location. It can be either SAS URI of an Azure storage blob with read access or public URI.

Parameters:

scriptUri - the scriptUri value to set.

Returns:

the VirtualMachineRunCommandScriptSource object itself.

withScriptUriManagedIdentity

public VirtualMachineRunCommandScriptSource withScriptUriManagedIdentity(RunCommandManagedIdentity scriptUriManagedIdentity)

Set the scriptUriManagedIdentity property: User-assigned managed identity that has access to scriptUri in case of Azure storage blob. Use an empty object in case of system-assigned identity. Make sure the Azure storage blob exists, and managed identity has been given access to blob's container with 'Storage Blob Data Reader' 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.

Parameters:

scriptUriManagedIdentity - the scriptUriManagedIdentity value to set.

Returns:

the VirtualMachineRunCommandScriptSource object itself.

Applies to