Skip to content

Commit dd57785

Browse files
committed
add queue id to other long running api calls
1 parent be2db2f commit dd57785

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListMailQuarantine.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ function Invoke-ListMailQuarantine {
2929
if ($RunningQueue) {
3030
$Metadata = [PSCustomObject]@{
3131
QueueMessage = 'Still loading data for all tenants. Please check back in a few more minutes'
32+
QueueId = $RunningQueue.RowKey
3233
}
3334
[PSCustomObject]@{
3435
Waiting = $true
@@ -39,6 +40,7 @@ function Invoke-ListMailQuarantine {
3940
$Queue = New-CippQueueEntry -Name 'Mail Quarantine - All Tenants' -Reference $QueueReference -TotalTasks ($TenantList | Measure-Object).Count
4041
$Metadata = [PSCustomObject]@{
4142
QueueMessage = 'Loading data for all tenants. Please check back in a few minutes'
43+
QueueId = $Queue.RowKey
4244
}
4345
$InputObject = [PSCustomObject]@{
4446
OrchestratorName = 'MailQuarantineOrchestrator'
@@ -57,6 +59,9 @@ function Invoke-ListMailQuarantine {
5759
Waiting = $true
5860
}
5961
} else {
62+
$Metadata = [PSCustomObject]@{
63+
QueueId = $RunningQueue.RowKey ?? $null
64+
}
6065
$messages = $Rows
6166
foreach ($message in $messages) {
6267
$messageObj = $message.QuarantineMessage | ConvertFrom-Json

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecJITAdmin.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,15 @@ function Invoke-ExecJITAdmin {
7575
if ($RunningQueue) {
7676
$Metadata = [PSCustomObject]@{
7777
QueueMessage = 'Still loading JIT Admin data for all tenants. Please check back in a few more minutes.'
78+
QueueId = $RunningQueue.RowKey
7879
}
7980
} elseif (!$Rows -and !$RunningQueue) {
8081
$TenantList = Get-Tenants -IncludeErrors
8182
$Queue = New-CippQueueEntry -Name 'JIT Admin List - All Tenants' -Link '/identity/administration/jit-admin?tenantFilter=AllTenants' -Reference $QueueReference -TotalTasks ($TenantList | Measure-Object).Count
8283

8384
$Metadata = [PSCustomObject]@{
8485
QueueMessage = 'Loading JIT Admin data for all tenants. Please check back in a few minutes.'
86+
QueueId = $Queue.RowKey
8587
}
8688
$InputObject = [PSCustomObject]@{
8789
OrchestratorName = 'JITAdminOrchestrator'
@@ -97,6 +99,9 @@ function Invoke-ExecJITAdmin {
9799
}
98100
Start-NewOrchestration -FunctionName 'CIPPOrchestrator' -InputObject ($InputObject | ConvertTo-Json -Depth 5 -Compress)
99101
} else {
102+
$Metadata = [PSCustomObject]@{
103+
QueueId = $RunningQueue.RowKey ?? $null
104+
}
100105
# There is data in the cache, so we will use that
101106
Write-Information "Found $($Rows.Count) rows in the cache"
102107
foreach ($row in $Rows) {

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Invoke-ExecAlertsList.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using namespace System.Net
22

3-
Function Invoke-ExecAlertsList {
3+
function Invoke-ExecAlertsList {
44
<#
55
.FUNCTIONALITY
66
Entrypoint
@@ -68,6 +68,7 @@ Function Invoke-ExecAlertsList {
6868
if ($RunningQueue) {
6969
$Metadata = [PSCustomObject]@{
7070
QueueMessage = 'Still loading data for all tenants. Please check back in a few more minutes'
71+
QueueId = $RunningQueue.RowKey
7172
}
7273
[PSCustomObject]@{
7374
Waiting = $true
@@ -78,6 +79,7 @@ Function Invoke-ExecAlertsList {
7879
$Queue = New-CippQueueEntry -Name 'Alerts List - All Tenants' -Reference $QueueReference -TotalTasks ($TenantList | Measure-Object).Count
7980
$Metadata = [PSCustomObject]@{
8081
QueueMessage = 'Loading data for all tenants. Please check back in a few minutes'
82+
QueueId = $Queue.RowKey
8183
}
8284
$InputObject = [PSCustomObject]@{
8385
OrchestratorName = 'AlertsOrchestrator'
@@ -97,6 +99,10 @@ Function Invoke-ExecAlertsList {
9799
InstanceId = $InstanceId
98100
}
99101
} else {
102+
$Metadata = [PSCustomObject]@{
103+
QueueId = $RunningQueue.RowKey ?? $null
104+
}
105+
100106
$Alerts = $Rows
101107
$AlertsObj = foreach ($Alert in $Alerts) {
102108
$AlertInfo = $Alert.Alert | ConvertFrom-Json

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Invoke-ExecIncidentsList.ps1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using namespace System.Net
22

3-
Function Invoke-ExecIncidentsList {
3+
function Invoke-ExecIncidentsList {
44
<#
55
.FUNCTIONALITY
66
Entrypoint
@@ -52,13 +52,15 @@ Function Invoke-ExecIncidentsList {
5252
if ($RunningQueue) {
5353
$Metadata = [PSCustomObject]@{
5454
QueueMessage = 'Still loading data for all tenants. Please check back in a few more minutes'
55+
QueueId = $RunningQueue.RowKey
5556
}
5657
} elseif (!$Rows -and !$RunningQueue) {
5758
# If no rows are found and no queue is running, we will start a new one
5859
$TenantList = Get-Tenants -IncludeErrors
5960
$Queue = New-CippQueueEntry -Name 'Incidents - All Tenants' -Link '/security/reports/incident-report?customerId=AllTenants' -Reference $QueueReference -TotalTasks ($TenantList | Measure-Object).Count
6061
$Metadata = [PSCustomObject]@{
6162
QueueMessage = 'Loading data for all tenants. Please check back in a few minutes'
63+
QueueId = $Queue.RowKey
6264
}
6365
$InputObject = [PSCustomObject]@{
6466
OrchestratorName = 'IncidentOrchestrator'
@@ -74,6 +76,9 @@ Function Invoke-ExecIncidentsList {
7476
}
7577
Start-NewOrchestration -FunctionName 'CIPPOrchestrator' -InputObject ($InputObject | ConvertTo-Json -Depth 5 -Compress) | Out-Null
7678
} else {
79+
$Metadata = [PSCustomObject]@{
80+
QueueId = $RunningQueue.RowKey ?? $null
81+
}
7782
$Incidents = $Rows
7883
foreach ($incident in $Incidents) {
7984
$IncidentObj = $incident.Incident | ConvertFrom-Json

0 commit comments

Comments
 (0)