Class MachineRunCommandScriptSource

java.lang.Object
com.azure.resourcemanager.hybridcompute.models.MachineRunCommandScriptSource
All Implemented Interfaces:
com.azure.json.JsonSerializable<MachineRunCommandScriptSource>

public final class MachineRunCommandScriptSource extends Object implements com.azure.json.JsonSerializable<MachineRunCommandScriptSource>
Describes the script sources for run command. Use only one of script, scriptUri, commandId.
  • Constructor Details

    • MachineRunCommandScriptSource

      public MachineRunCommandScriptSource()
      Creates an instance of MachineRunCommandScriptSource class.
  • Method Details

    • script

      public String script()
      Get the script property: Specifies the script content to be executed on the machine.
      Returns:
      the script value.
    • withScript

      public MachineRunCommandScriptSource withScript(String script)
      Set the script property: Specifies the script content to be executed on the machine.
      Parameters:
      script - the script value to set.
      Returns:
      the MachineRunCommandScriptSource object itself.
    • 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.
    • withScriptUri

      public MachineRunCommandScriptSource 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 MachineRunCommandScriptSource object itself.
    • commandId

      public String commandId()
      Get the commandId property: Specifies the commandId of predefined built-in script.
      Returns:
      the commandId value.
    • withCommandId

      public MachineRunCommandScriptSource withCommandId(String commandId)
      Set the commandId property: Specifies the commandId of predefined built-in script.
      Parameters:
      commandId - the commandId value to set.
      Returns:
      the MachineRunCommandScriptSource object itself.
    • 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.
    • withScriptUriManagedIdentity

      public MachineRunCommandScriptSource 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 MachineRunCommandScriptSource object itself.
    • validate

      public void validate()
      Validates the instance.
      Throws:
      IllegalArgumentException - thrown if the instance is not valid.
    • toJson

      public com.azure.json.JsonWriter toJson(com.azure.json.JsonWriter jsonWriter) throws IOException
      Specified by:
      toJson in interface com.azure.json.JsonSerializable<MachineRunCommandScriptSource>
      Throws:
      IOException
    • fromJson

      public static MachineRunCommandScriptSource fromJson(com.azure.json.JsonReader jsonReader) throws IOException
      Reads an instance of MachineRunCommandScriptSource from the JsonReader.
      Parameters:
      jsonReader - The JsonReader being read.
      Returns:
      An instance of MachineRunCommandScriptSource 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 MachineRunCommandScriptSource.