Class ImageTemplatePowerShellValidator
- java.lang.Object
-
- com.azure.resourcemanager.imagebuilder.models.ImageTemplateInVMValidator
-
- com.azure.resourcemanager.imagebuilder.models.ImageTemplatePowerShellValidator
-
public final class ImageTemplatePowerShellValidator extends ImageTemplateInVMValidator
Runs the specified PowerShell script during the validation phase (Windows). Corresponds to Packer powershell provisioner. Exactly one of 'scriptUri' or 'inline' can be specified.
-
-
Constructor Summary
Constructors Constructor Description ImageTemplatePowerShellValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>
inline()
Get the inline property: Array of PowerShell commands to execute.Boolean
runAsSystem()
Get the runAsSystem property: If specified, the PowerShell script will be run with elevated privileges using the Local System user.Boolean
runElevated()
Get the runElevated property: If specified, the PowerShell script will be run with elevated privileges.String
scriptUri()
Get the scriptUri property: URI of the PowerShell script to be run for validation.String
sha256Checksum()
Get the sha256Checksum property: SHA256 checksum of the power shell script provided in the scriptUri field above.void
validate()
Validates the instance.List<Integer>
validExitCodes()
Get the validExitCodes property: Valid exit codes for the PowerShell script.ImageTemplatePowerShellValidator
withInline(List<String> inline)
Set the inline property: Array of PowerShell commands to execute.ImageTemplatePowerShellValidator
withName(String name)
Set the name property: Friendly Name to provide context on what this validation step does.ImageTemplatePowerShellValidator
withRunAsSystem(Boolean runAsSystem)
Set the runAsSystem property: If specified, the PowerShell script will be run with elevated privileges using the Local System user.ImageTemplatePowerShellValidator
withRunElevated(Boolean runElevated)
Set the runElevated property: If specified, the PowerShell script will be run with elevated privileges.ImageTemplatePowerShellValidator
withScriptUri(String scriptUri)
Set the scriptUri property: URI of the PowerShell script to be run for validation.ImageTemplatePowerShellValidator
withSha256Checksum(String sha256Checksum)
Set the sha256Checksum property: SHA256 checksum of the power shell script provided in the scriptUri field above.ImageTemplatePowerShellValidator
withValidExitCodes(List<Integer> validExitCodes)
Set the validExitCodes property: Valid exit codes for the PowerShell script.-
Methods inherited from class com.azure.resourcemanager.imagebuilder.models.ImageTemplateInVMValidator
name
-
-
-
-
Method Detail
-
scriptUri
public String scriptUri()
Get the scriptUri property: URI of the PowerShell script to be run for validation. It can be a github link, Azure Storage URI, etc.- Returns:
- the scriptUri value.
-
withScriptUri
public ImageTemplatePowerShellValidator withScriptUri(String scriptUri)
Set the scriptUri property: URI of the PowerShell script to be run for validation. It can be a github link, Azure Storage URI, etc.- Parameters:
scriptUri
- the scriptUri value to set.- Returns:
- the ImageTemplatePowerShellValidator object itself.
-
sha256Checksum
public String sha256Checksum()
Get the sha256Checksum property: SHA256 checksum of the power shell script provided in the scriptUri field above.- Returns:
- the sha256Checksum value.
-
withSha256Checksum
public ImageTemplatePowerShellValidator withSha256Checksum(String sha256Checksum)
Set the sha256Checksum property: SHA256 checksum of the power shell script provided in the scriptUri field above.- Parameters:
sha256Checksum
- the sha256Checksum value to set.- Returns:
- the ImageTemplatePowerShellValidator object itself.
-
inline
public List<String> inline()
Get the inline property: Array of PowerShell commands to execute.- Returns:
- the inline value.
-
withInline
public ImageTemplatePowerShellValidator withInline(List<String> inline)
Set the inline property: Array of PowerShell commands to execute.- Parameters:
inline
- the inline value to set.- Returns:
- the ImageTemplatePowerShellValidator object itself.
-
runElevated
public Boolean runElevated()
Get the runElevated property: If specified, the PowerShell script will be run with elevated privileges.- Returns:
- the runElevated value.
-
withRunElevated
public ImageTemplatePowerShellValidator withRunElevated(Boolean runElevated)
Set the runElevated property: If specified, the PowerShell script will be run with elevated privileges.- Parameters:
runElevated
- the runElevated value to set.- Returns:
- the ImageTemplatePowerShellValidator object itself.
-
runAsSystem
public Boolean runAsSystem()
Get the runAsSystem property: If specified, the PowerShell script will be run with elevated privileges using the Local System user. Can only be true when the runElevated field above is set to true.- Returns:
- the runAsSystem value.
-
withRunAsSystem
public ImageTemplatePowerShellValidator withRunAsSystem(Boolean runAsSystem)
Set the runAsSystem property: If specified, the PowerShell script will be run with elevated privileges using the Local System user. Can only be true when the runElevated field above is set to true.- Parameters:
runAsSystem
- the runAsSystem value to set.- Returns:
- the ImageTemplatePowerShellValidator object itself.
-
validExitCodes
public List<Integer> validExitCodes()
Get the validExitCodes property: Valid exit codes for the PowerShell script. [Default: 0].- Returns:
- the validExitCodes value.
-
withValidExitCodes
public ImageTemplatePowerShellValidator withValidExitCodes(List<Integer> validExitCodes)
Set the validExitCodes property: Valid exit codes for the PowerShell script. [Default: 0].- Parameters:
validExitCodes
- the validExitCodes value to set.- Returns:
- the ImageTemplatePowerShellValidator object itself.
-
withName
public ImageTemplatePowerShellValidator withName(String name)
Set the name property: Friendly Name to provide context on what this validation step does.- Overrides:
withName
in classImageTemplateInVMValidator
- Parameters:
name
- the name value to set.- Returns:
- the ImageTemplateInVMValidator object itself.
-
validate
public void validate()
Validates the instance.- Overrides:
validate
in classImageTemplateInVMValidator
- Throws:
IllegalArgumentException
- thrown if the instance is not valid.
-
-