Skip to content

Commit fac4783

Browse files
committed
Added limit parameter in Get-CVJob
1 parent 6df1d7d commit fac4783

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

Modules/Commvault.JobManager/Commvault.JobManager.psm1

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ function Get-CVJob {
3838
.PARAMETER Details
3939
Retrieves the details for a job.
4040
41+
.PARAMETER limit
42+
The number of results to be listed in a page. Used for changing the paging limits. By default, the limit is 100 results per page.
43+
4144
.PARAMETER First
4245
Get list of jobs with paging support -First 20 (20 per page).
4346
@@ -118,6 +121,10 @@ function Get-CVJob {
118121
[ValidateNotNullorEmpty()]
119122
[Int32] $CompletedTime = 24, # default 24 hours
120123

124+
[Parameter(Mandatory = $False, ParameterSetName = 'Default')]
125+
[ValidateNotNullorEmpty()]
126+
[Int32] $limit = 100,
127+
121128
[Switch] $Details
122129
)
123130

@@ -207,6 +214,13 @@ function Get-CVJob {
207214
else {
208215
$sessionObj.requestProps.endpoint = $sessionObj.requestProps.endpoint -creplace ('{completedJobLookupTime}', $null)
209216
}
217+
218+
if ($limit) {
219+
$sessionObj.requestProps.endpoint = $sessionObj.requestProps.endpoint -creplace ('{limit}', $limit)
220+
}
221+
else {
222+
$sessionObj.requestProps.endpoint = $sessionObj.requestProps.endpoint -creplace ('{limit}', $null)
223+
}
210224

211225
if ($PSCmdlet.PagingParameters.First -eq [Uint64]::MaxValue) { # MaxValue is system default
212226
if ($PSCmdlet.PagingParameters.IncludeTotalCount.IsPresent) {

Modules/Commvault.RESTSession/Commvault.RESTSession.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ function GetAPIDetail ([String] $Request) {
802802
'Get-CVJob' = @{
803803

804804
Description = 'Get the list of all jobs in CommServe'
805-
Endpoint = 'Job?completedJobLookupTime={completedJobLookupTime}'
805+
Endpoint = 'Job?completedJobLookupTime={completedJobLookupTime}&limit={limit}'
806806
Method = 'Get'
807807
Body = ''
808808
}

0 commit comments

Comments
 (0)