Skip to content

Commit 4f781f2

Browse files
authored
Merge pull request #39 from Commvault/branch1
Branch1: Adding latest code to github from CVS
2 parents f98cd99 + ca5bd27 commit 4f781f2

File tree

14 files changed

+180
-32
lines changed

14 files changed

+180
-32
lines changed
-5.19 KB
Binary file not shown.

Modules/Commvault.CommCell/Commvault.CommCell.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ function Set-CVSubclient {
655655
}
656656
}
657657
"@
658-
PS C:\>$propobj = $prop | ConvertFrom-Json
658+
PS C:\>$propobj = $req | ConvertFrom-Json
659659
PS C:\>Set-CVSubclient -body $propobj
660660
661661
.OUTPUTS
-4.08 KB
Binary file not shown.
-4.29 KB
Binary file not shown.

Modules/Commvault.JobManager/Commvault.JobManager.psm1

Lines changed: 136 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ function Get-CVJob {
299299

300300

301301
function Get-CVJobDetail {
302-
<#
302+
<#
303303
.SYNOPSIS
304304
Gets extended details for a job.
305305
@@ -309,6 +309,9 @@ function Get-CVJobDetail {
309309
.PARAMETER Id
310310
Gets extended details for the job specified by Id.
311311
312+
.PARAMETER InfoType
313+
Gets additional job information.
314+
312315
.PARAMETER JobObject
313316
Gets extended details for the job specified by piped JobObject.
314317
@@ -330,6 +333,9 @@ function Get-CVJobDetail {
330333
.EXAMPLE
331334
Get-CVJobDetail -Id 175 | Select-Object -ExpandProperty progressInfo
332335
336+
.EXAMPLE
337+
Get-CVJobDetail -Id 175 InfoType 1
338+
333339
.OUTPUTS
334340
Outputs [PSCustomObject] containing result.
335341
@@ -346,53 +352,91 @@ function Get-CVJobDetail {
346352
[ValidateNotNullorEmpty()]
347353
[Int32] $Id,
348354

355+
[Parameter(Mandatory = $False, ParameterSetName = 'ById', ValueFromPipeline = $True, ValueFromPipelineByPropertyName = $True)]
356+
[ValidateNotNullorEmpty()]
357+
[Int32] $InfoType,
358+
349359
[Parameter(Mandatory = $True, ParameterSetName = 'ByObject', ValueFromPipeline = $True, ValueFromPipelineByPropertyName = $True)]
350360
[ValidateNotNullorEmpty()]
351361
[System.Object] $JobObject
352362
)
353363

354-
begin { Write-Debug -Message "$($MyInvocation.MyCommand): begin"
364+
begin {
365+
Write-Debug -Message "$($MyInvocation.MyCommand): begin"
355366

356367
try {
357-
$sessionObj = Get-CVSessionDetail $MyInvocation.MyCommand.Name
358-
$endpointSave = $sessionObj.requestProps.endpoint
368+
if ($InfoType -eq 0) {
369+
$sessionObj = Get-CVSessionDetail $MyInvocation.MyCommand.Name
370+
$endpointSave = $sessionObj.requestProps.endpoint
371+
}
372+
else {
373+
$sessionObj = Get-CVSessionDetail 'GetJobById'
374+
$endpointSave = $sessionObj.requestProps.endpoint
375+
}
359376
}
360377
catch {
361378
throw $_
362379
}
363380
}
364381

365-
process { Write-Debug -Message "$($MyInvocation.MyCommand): process"
382+
process {
383+
Write-Debug -Message "$($MyInvocation.MyCommand): process"
366384

367385
try {
368-
$sessionObj.requestProps.endpoint = $endpointSave
386+
if ($InfoType -gt 0) {
387+
if ($PSCmdlet.ParameterSetName -eq 'ById') {
388+
$job_id = $Id
389+
}
390+
else {
391+
$job_id = $JobObject.jobId
392+
}
393+
$sessionObj.requestProps.endpoint = $sessionObj.requestProps.endpoint -creplace ('{jobId}', ($job_id))
394+
$sessionObj.requestProps.endpoint = -join ($sessionObj.requestProps.endpoint, "/AdvancedDetails?infoType=", $InfoType)
395+
$body = ''
396+
$headerObj = Get-CVRESTHeader $sessionObj
397+
$payload = @{ }
398+
$payload.Add('headerObject', $headerObj)
399+
$payload.Add('body', $body)
400+
$validate = ''
369401

370-
$headerObj = Get-CVRESTHeader $sessionObj
371-
$jobObj = @{ }
372-
if ($PSCmdlet.ParameterSetName -eq 'ById') {
373-
$jobObj.Add('jobId', $Id)
402+
$response = Submit-CVRESTRequest $payload $validate
403+
404+
if ($response.IsValid) {
405+
Write-Output $response.Content
406+
}
374407
}
375408
else {
376-
$jobObj.Add('jobId', $JobObject.jobId)
377-
}
378-
$body = $jobObj | ConvertTo-Json -Depth 10
379-
$payload = @{ }
380-
$payload.Add('headerObject', $headerObj)
381-
$payload.Add('body', $body)
382-
$validate = 'job'
409+
$sessionObj.requestProps.endpoint = $endpointSave
383410

384-
$response = Submit-CVRESTRequest $payload $validate
385-
386-
if ($response.IsValid) {
387-
Write-Output $response.Content.job.jobDetail
411+
$headerObj = Get-CVRESTHeader $sessionObj
412+
$jobObj = @{ }
413+
if ($PSCmdlet.ParameterSetName -eq 'ById') {
414+
$jobObj.Add('jobId', $Id)
415+
}
416+
else {
417+
$jobObj.Add('jobId', $JobObject.jobId)
418+
}
419+
$body = $jobObj | ConvertTo-Json -Depth 10
420+
$payload = @{ }
421+
$payload.Add('headerObject', $headerObj)
422+
$payload.Add('body', $body)
423+
$validate = 'job'
424+
425+
$response = Submit-CVRESTRequest $payload $validate
426+
427+
if ($response.IsValid) {
428+
Write-Output $response.Content.job.jobDetail
429+
}
388430
}
431+
389432
}
390433
catch {
391434
throw $_
392435
}
393436
}
394437

395-
end { Write-Debug -Message "$($MyInvocation.MyCommand): end"
438+
end {
439+
Write-Debug -Message "$($MyInvocation.MyCommand): end"
396440
}
397441
}
398442

@@ -539,7 +583,75 @@ function Resume-CVJob {
539583
end { Write-Debug -Message "$($MyInvocation.MyCommand): end"
540584
}
541585
}
542-
586+
function Resubmit-CVJob {
587+
<#
588+
.SYNOPSIS
589+
Resubmit the job specified by job Id.
590+
591+
.DESCRIPTION
592+
Resubmit the job specified by job Id.
593+
594+
.PARAMETER JobId
595+
Resubmit the job specified by JobId.
596+
597+
.EXAMPLE
598+
Resubmit-CVJob -JobId 78
599+
600+
.OUTPUTS
601+
Outputs [PSCustomObject] containing result.
602+
603+
.NOTES
604+
Author: Jnanesh D
605+
Company: Commvault
606+
#>
607+
[CmdletBinding()]
608+
[OutputType([PSCustomObject])]
609+
param(
610+
[Parameter(Mandatory = $True)]
611+
[ValidateNotNullorEmpty()]
612+
[Int32] $JobId
613+
)
614+
615+
begin { Write-Debug -Message "$($MyInvocation.MyCommand): begin"
616+
617+
try {
618+
$sessionObj = Get-CVSessionDetail $MyInvocation.MyCommand.Name
619+
$endpointSave = $sessionObj.requestProps.endpoint
620+
}
621+
catch {
622+
throw $_
623+
}
624+
}
625+
626+
process { Write-Debug -Message "$($MyInvocation.MyCommand): process"
627+
628+
try {
629+
$sessionObj.requestProps.endpoint = $endpointSave
630+
$sessionObj.requestProps.endpoint = $sessionObj.requestProps.endpoint -creplace ('{jobId}', $JobId)
631+
632+
$headerObj = Get-CVRESTHeader $sessionObj
633+
$body = ''
634+
$payload = @{ }
635+
$payload.Add('headerObject', $headerObj)
636+
$payload.Add('body', $body)
637+
638+
$response = Submit-CVRESTRequest $payload 'jobIds'
639+
640+
if ($response.IsValid) {
641+
Write-Output $response.Content
642+
}
643+
else {
644+
Write-Information -InformationAction Continue -MessageData "INFO: $($MyInvocation.MyCommand): resume request was not succesfully submitted for job [$JobId]"
645+
}
646+
}
647+
catch {
648+
throw $_
649+
}
650+
}
651+
652+
end { Write-Debug -Message "$($MyInvocation.MyCommand): end"
653+
}
654+
}
543655

544656
function Stop-CVJob {
545657
<#
@@ -1657,4 +1769,4 @@ function PrepareSendLogFilesBodyJson ($PrepInputs) {
16571769
catch {
16581770
throw $_
16591771
}
1660-
}
1772+
}
-4.3 KB
Binary file not shown.

Modules/Commvault.Policies/Commvault.Policies.psm1

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,9 +1075,34 @@ function Add-CVBlackoutWindow {
10751075
Switch to Force override of default 'WhatIf' confirmation behavior.
10761076
10771077
.EXAMPLE
1078-
PS C:\>$props = Get-CVBlackoutWindow -Name 'My Blackout Rule'
1079-
PS C:\>$props.name='Your Blackout Rule'
1080-
PS C:\>$props | Add-CVBlackoutWindow -Force
1078+
PS C:\>$props = @"
1079+
{
1080+
"operationWindow": {
1081+
"endDate": 1521691200,
1082+
"name": "Holiday_1",
1083+
"startDate": 1520485200,
1084+
"operations": [
1085+
1,
1086+
2
1087+
],
1088+
"dayTime": [
1089+
{
1090+
"startTime": 46800,
1091+
"endTime": 50400,
1092+
"dayOfWeek": [
1093+
1,
1094+
2
1095+
]
1096+
}
1097+
]
1098+
},
1099+
"entity": {
1100+
"clientGroupId": 0,
1101+
"clientId": 2
1102+
}
1103+
}"@
1104+
PS C:\>$propobj = $prop | ConvertFrom-Json
1105+
PS C:\>$propobj | Add-CVBlackoutWindow -Force
10811106
10821107
.OUTPUTS
10831108
Outputs [PSCustomObject] containing job submission result.
@@ -1111,7 +1136,7 @@ function Add-CVBlackoutWindow {
11111136

11121137
try {
11131138
$sessionObj.requestProps.endpoint = $endpointSave
1114-
if ($Force -or $PSCmdlet.ShouldProcess($Properties.name)) {
1139+
if ($Force -or ($PSCmdlet.ShouldProcess($Properties.operationWindow.name))) {
11151140
ProcessBlackoutWindowUpdate $sessionObj $Properties $False
11161141
}
11171142
else {
@@ -1353,7 +1378,9 @@ function ProcessBlackoutWindowUpdate([System.Object] $Session, [System.Object] $
13531378
if (HasProperty $Properties 'dayTime') {
13541379
$opWin.Add('dayTime', $Properties.dayTime)
13551380
}
1356-
1381+
if (HasProperty $Properties "operationWindow"){
1382+
$opWin = $Properties.operationWindow
1383+
}
13571384
$entity = $Properties.entity
13581385
$body.Add('operationWindow', $opWin)
13591386
$body.Add('entity', $entity)
-4.13 KB
Binary file not shown.

Modules/Commvault.RESTSession/Commvault.RESTSession.psm1

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,16 @@ function GetAPIDetail ([String] $Request) {
855855
Body = ''
856856

857857
}
858-
858+
859+
'Resubmit-CVJob' = @{
860+
861+
Description = 'Resubmit the specified job'
862+
Endpoint = 'Job/{jobId}/action/resubmit'
863+
Method = 'Post'
864+
Body = ''
865+
866+
}
867+
859868
'Resume-CVJob' = @{
860869

861870
Description = 'Resume the specified job'
@@ -1135,7 +1144,7 @@ function GetAPIDetail ([String] $Request) {
11351144
'Backup-CVSQLSubclient' = @{
11361145

11371146
Description = 'Backup SQL instance subclients'
1138-
Endpoint = 'v2/sql/instances/{instanceId}/backup?subClientId={subclientId}'
1147+
Endpoint = 'v2/sql/instances/{instanceId}/backup?subclient={subclientId}'
11391148
Method = 'Post'
11401149
Body = ''
11411150
}
-4.47 KB
Binary file not shown.

0 commit comments

Comments
 (0)