Add Parameter Validations

This commit is contained in:
Wes Carroll
2019-04-16 16:18:33 -04:00
parent 2e4cd68b5e
commit ed225024a6
7 changed files with 12 additions and 3 deletions
@@ -33,6 +33,8 @@ function Invoke-ZertoFailover {
[Parameter( [Parameter(
HelpMessage = "The amount of time in seconds the failover waits in a Before Commit state to enable checking that the failover is as required before performing the commitPolicy setting. Default is 60 Minutes (3600 Seconds)" HelpMessage = "The amount of time in seconds the failover waits in a Before Commit state to enable checking that the failover is as required before performing the commitPolicy setting. Default is 60 Minutes (3600 Seconds)"
)] )]
# Min 5 Minutes, Max 24 Hours, Default 1 Hour.
[ValidateRange(300, 86400)]
[int]$timeToWaitBeforeShutdownInSec = 3600, [int]$timeToWaitBeforeShutdownInSec = 3600,
[Parameter( [Parameter(
HelpMessage = "True: Enable reverse protection. The virtual machines are recovered on the recovery site and then protected using the default reverse protection settings. HelpMessage = "True: Enable reverse protection. The virtual machines are recovered on the recovery site and then protected using the default reverse protection settings.
@@ -6,6 +6,7 @@ function Invoke-ZertoFailoverCommit {
HelpMessage = "Name(s) of the VPG(s) to commit.", HelpMessage = "Name(s) of the VPG(s) to commit.",
Mandatory = $true Mandatory = $true
)] )]
[ValidateNotNullOrEmpty()]
[string[]]$vpgName, [string[]]$vpgName,
[Parameter( [Parameter(
HelpMessage = "Use this switch to reverse protect the VPG(s) to the source site." HelpMessage = "Use this switch to reverse protect the VPG(s) to the source site."
@@ -6,6 +6,7 @@ function Invoke-ZertoFailoverRollback {
HelpMessage = "Name(s) of VPG(s) to roll back from failing over", HelpMessage = "Name(s) of VPG(s) to roll back from failing over",
Mandatory = $true Mandatory = $true
)] )]
[ValidateNotNullOrEmpty()]
[string[]]$vpgName [string[]]$vpgName
) )
@@ -6,6 +6,7 @@ function Invoke-ZertoForceSync {
HelpMessage = "Name(s) of VPG(s) to force sync", HelpMessage = "Name(s) of VPG(s) to force sync",
Mandatory = $true Mandatory = $true
)] )]
[ValidateNotNullOrEmpty()]
[string[]]$vpgName [string[]]$vpgName
) )
+3 -1
View File
@@ -19,7 +19,9 @@ function Invoke-ZertoMove {
[Parameter( [Parameter(
HelpMessage = "The amount of time, in seconds, the Move is in a 'Before Commit' state, before performing the commitPolicy setting. If omitted, the site settings default will be applied." HelpMessage = "The amount of time, in seconds, the Move is in a 'Before Commit' state, before performing the commitPolicy setting. If omitted, the site settings default will be applied."
)] )]
[Int32]$commitPolicyTimeout, # Min 5 Minutes, Max 24 Hours, Default 1 Hour.
[ValidateRange(300, 86400)]
[Int]$commitPolicyTimeout,
[Parameter( [Parameter(
HelpMessage = "If this switch is specified, Zerto will attempt to gracefully shut down the Virtual Machines. If the machines do not poweroff within 5 minutes, they will be forcibly powering them off." HelpMessage = "If this switch is specified, Zerto will attempt to gracefully shut down the Virtual Machines. If the machines do not poweroff within 5 minutes, they will be forcibly powering them off."
)] )]
@@ -6,6 +6,7 @@ function Invoke-ZertoMoveCommit {
HelpMessage = "Name(s) of the VPG(s) to commit.", HelpMessage = "Name(s) of the VPG(s) to commit.",
Mandatory = $true Mandatory = $true
)] )]
[ValidateNotNullOrEmpty()]
[string[]]$vpgName, [string[]]$vpgName,
[Parameter( [Parameter(
HelpMessage = "Set this to True to reverse protect the VPG(s) to the source site. If not set, will use selection made during move initiation. True or False" HelpMessage = "Set this to True to reverse protect the VPG(s) to the source site. If not set, will use selection made during move initiation. True or False"
@@ -6,6 +6,7 @@ function Invoke-ZertoMoveRollback {
HelpMessage = "Name(s) of VPG(s) to roll back from failing over", HelpMessage = "Name(s) of VPG(s) to roll back from failing over",
Mandatory = $true Mandatory = $true
)] )]
[ValidateNotNullOrEmpty()]
[string[]]$vpgName [string[]]$vpgName
) )