< Back

Wait-NsxJob

Sat Jan 18, 2020 9:30 pm

NAME Wait-NsxJob



SYNOPSIS

Wait for the specified job until completion criteria tests true.





SYNTAX

Wait-NsxJob [-jobid] <String> [-JobStatusUri] <String> [-CompleteCriteria] <ScriptBlock> [-FailCriteria]

<ScriptBlock> [-StatusExpression] <ScriptBlock> [[-ErrorExpression] <ScriptBlock>] [[-WaitTimeout] <Int32>]

[-FailOnTimeout] [[-SleepSeconds] <Int32>] [[-Connection] <PSObject>] [<CommonParameters>]





DESCRIPTION

Attempt to wait for the specified job until completion criteria tests true.



Timeout is either warning and allow user to quit/throw, or to Throw on

timeout.



Success and Failure criteria can be expressed via scriptblock ($job is the

returned XML object that you can traverse)



Status expression and ErrorExpression provide methods of providing output

of Success or Failure criteria.



Intended to be internal generic job wait routine for PowerNSX cmdlet

consumption.



PowerNSX users should use object specific Wait-Nsx*Job or Wiat-NsxGenericJob

Cmdlets that call this cmdlet.





PARAMETERS

-jobid <String>

Job Id string as returned from the api



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-JobStatusUri <String>

Job Query URI. There are several job subsystems in NSX. Some of them overlap.



Required? true

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-CompleteCriteria <ScriptBlock>

ScriptBlock that is used to evaluate completion. $job is the xml object returned from the API, so this should

be something like { $job.controllerDeploymentInfo.status -eq "Success" }



Required? true

Position? 3

Default value

Accept pipeline input? false

Accept wildcard characters? false



-FailCriteria <ScriptBlock>

ScriptBlock that is used to evaluate completion. $job is the xml object returned from the API, so this should

be something like { $job.controllerDeploymentInfo.status -eq "Failure" }. Wait-NsxJob will return immediately

if this tests true.



Required? true

Position? 4

Default value

Accept pipeline input? false

Accept wildcard characters? false



-StatusExpression <ScriptBlock>

Scriptblock that is used to retrieve a status string. $job is the xml object returned from the API, so this

should be something like { $job.controllerDeploymentInfo.status }. Used only in status output (not in job

completion criteria.)



Required? true

Position? 5

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ErrorExpression <ScriptBlock>

ScriptBlock that is used to retrieve any error string. Defaults to $StatusExpression. $job is the xml object

returned from the API, so this should be something like { $job.controllerDeploymentInfo.ExceptionMessage }.

This is only used in warning/error output (not in job completion criteria.)



Required? false

Position? 6

Default value $StatusExpression

Accept pipeline input? false

Accept wildcard characters? false



-WaitTimeout <Int32>

Seconds to wait before declaring a timeout



Required? false

Position? 7

Default value 300

Accept pipeline input? false

Accept wildcard characters? false



-FailOnTimeout [<SwitchParameter>]

Do we prompt user an allow them to reset the timeout timer, or throw on timeout



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-SleepSeconds <Int32>

Number of seconds to sleep between status checks



Required? false

Position? 8

Default value 1

Accept pipeline input? false

Accept wildcard characters? false



-Connection <PSObject>

PowerNSX Connection object



Required? false

Position? 9

Default value $defaultNSXConnection

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS





RELATED LINKS