-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathGet-GitHubStatusIncident.ps1
More file actions
71 lines (57 loc) · 1.99 KB
/
Get-GitHubStatusIncident.ps1
File metadata and controls
71 lines (57 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
function Get-GitHubStatusIncident {
<#
.SYNOPSIS
Gets the status of GitHub incidents
.DESCRIPTION
Incidents are the cornerstone of any status page, being composed of many incident updates.
Each incident usually goes through a progression of statuses listed below, with an impact
calculated from a blend of component statuses (or an optional override).
Status: Investigating, Identified, Monitoring, Resolved, or Postmortem
Impact: None (black), Minor (yellow), Major (orange), or Critical (red)
.EXAMPLE
```powershell
Get-GitHubStatusIncident
```
Gets the status of GitHub incidents
.EXAMPLE
```powershell
Get-GitHubStatusIncident -Unresolved
```
Gets the status of GitHub incidents that are unresolved
.NOTES
[Incidents](https://www.githubstatus.com/api#incidents)
.LINK
https://psmodule.io/GitHub/Functions/Status/Get-GitHubStatusIncident
#>
[OutputType([pscustomobject[]])]
[Alias('Get-GitHubStatusIncidents')]
[CmdletBinding()]
param(
# Gets the status of GitHub incidents that are unresolved
[Parameter()]
[switch] $Unresolved,
# The stamp to check status for.
[Parameter()]
[ValidateSet('Public', 'Europe', 'Australia', 'US', 'Japan')]
[string] $Stamp = 'Public'
)
begin {
$stackPath = Get-PSCallStackPath
Write-Debug "[$stackPath] - Start"
}
process {
$baseURL = $script:StatusBaseURL[$Stamp]
if ($Unresolved) {
$APIURI = "$baseURL/api/v2/incidents/unresolved.json"
$response = Invoke-RestMethod -Uri $APIURI -Method Get
$response.incidents
return
}
$APIURI = "$baseURL/api/v2/incidents.json"
$response = Invoke-RestMethod -Uri $APIURI -Method Get
$response.incidents
}
end {
Write-Debug "[$stackPath] - End"
}
}