Class VirtualMachineRunCommandScriptSource
java.lang.Object
com.azure.resourcemanager.compute.models.VirtualMachineRunCommandScriptSource
- All Implemented Interfaces:
com.azure.json.JsonSerializable<VirtualMachineRunCommandScriptSource>
public final class VirtualMachineRunCommandScriptSource
extends Object
implements com.azure.json.JsonSerializable<VirtualMachineRunCommandScriptSource>
Describes the script sources for run command. Use only one of these script sources: script, scriptUri, commandId,
galleryScriptReferenceId.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an instance of VirtualMachineRunCommandScriptSource class. -
Method Summary
Modifier and TypeMethodDescriptionGet the commandId property: Specifies a commandId of predefined built-in script.fromJson(com.azure.json.JsonReader jsonReader) Reads an instance of VirtualMachineRunCommandScriptSource from the JsonReader.Get the galleryScriptReferenceId property: The resource ID of a Gallery Script version that needs to be executed.script()Get the script property: Specifies the script content to be executed on the VM.Get the scriptShell property: Optional.Get the scriptUri property: Specifies the script download location.Get the scriptUriManagedIdentity property: User-assigned managed identity that has access to scriptUri in case of Azure storage blob.com.azure.json.JsonWritertoJson(com.azure.json.JsonWriter jsonWriter) voidvalidate()Validates the instance.withCommandId(String commandId) Set the commandId property: Specifies a commandId of predefined built-in script.withGalleryScriptReferenceId(String galleryScriptReferenceId) Set the galleryScriptReferenceId property: The resource ID of a Gallery Script version that needs to be executed.withScript(String script) Set the script property: Specifies the script content to be executed on the VM.withScriptShell(ScriptShellTypes scriptShell) Set the scriptShell property: Optional.withScriptUri(String scriptUri) Set the scriptUri property: Specifies the script download location.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 class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.azure.json.JsonSerializable
toJson, toJson, toJsonBytes, toJsonString
-
Constructor Details
-
VirtualMachineRunCommandScriptSource
public VirtualMachineRunCommandScriptSource()Creates an instance of VirtualMachineRunCommandScriptSource class.
-
-
Method Details
-
script
Get the script property: Specifies the script content to be executed on the VM.- Returns:
- the script value.
-
withScript
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.
-
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.
-
withScriptUri
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.
-
commandId
Get the commandId property: Specifies a commandId of predefined built-in script. Command IDs available for Linux are listed at https://aka.ms/RunCommandManagedLinux#available-commands, Windows at https://aka.ms/RunCommandManagedWindows#available-commands.- Returns:
- the commandId value.
-
withCommandId
Set the commandId property: Specifies a commandId of predefined built-in script. Command IDs available for Linux are listed at https://aka.ms/RunCommandManagedLinux#available-commands, Windows at https://aka.ms/RunCommandManagedWindows#available-commands.- Parameters:
commandId- the commandId value to set.- Returns:
- the VirtualMachineRunCommandScriptSource object itself.
-
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.
-
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.
-
scriptShell
Get the scriptShell property: Optional. Specify which shell to use for running the script. These values must match those expected by the extension. Currently supported only for Windows VMs, script uses Powershell 7 when specified. Powershell 7 must be already installed on the machine to use Powershell7 parameter value.- Returns:
- the scriptShell value.
-
withScriptShell
Set the scriptShell property: Optional. Specify which shell to use for running the script. These values must match those expected by the extension. Currently supported only for Windows VMs, script uses Powershell 7 when specified. Powershell 7 must be already installed on the machine to use Powershell7 parameter value.- Parameters:
scriptShell- the scriptShell value to set.- Returns:
- the VirtualMachineRunCommandScriptSource object itself.
-
galleryScriptReferenceId
Get the galleryScriptReferenceId property: The resource ID of a Gallery Script version that needs to be executed. Example ID looks like /subscriptions/{subId}/resourceGroups/{rgName}/providers/Microsoft.Compute/galleries/{galleryName}/scripts/{scriptName}/versions/{version}.- Returns:
- the galleryScriptReferenceId value.
-
withGalleryScriptReferenceId
public VirtualMachineRunCommandScriptSource withGalleryScriptReferenceId(String galleryScriptReferenceId) Set the galleryScriptReferenceId property: The resource ID of a Gallery Script version that needs to be executed. Example ID looks like /subscriptions/{subId}/resourceGroups/{rgName}/providers/Microsoft.Compute/galleries/{galleryName}/scripts/{scriptName}/versions/{version}.- Parameters:
galleryScriptReferenceId- the galleryScriptReferenceId value to set.- Returns:
- the VirtualMachineRunCommandScriptSource object itself.
-
validate
public void validate()Validates the instance.- Throws:
IllegalArgumentException- thrown if the instance is not valid.
-
toJson
- Specified by:
toJsonin interfacecom.azure.json.JsonSerializable<VirtualMachineRunCommandScriptSource>- Throws:
IOException
-
fromJson
public static VirtualMachineRunCommandScriptSource fromJson(com.azure.json.JsonReader jsonReader) throws IOException 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.
-