Modules/AzureDevOpsDsc.Common/Api/Functions/Private/Api/NotificationSubscription/New-DevOpsNotificationSubscription.ps1
|
Function New-DevOpsNotificationSubscription { [CmdletBinding()] param( [Parameter(Mandatory)][string]$ApiUri, [Parameter(Mandatory)][string]$EventType, [Parameter(Mandatory)][hashtable]$Channel, [Parameter()][hashtable]$Filter, [Parameter()][string]$Description, [Parameter()][string]$ApiVersion = '7.1-preview.1' ) $body = @{ eventType = $EventType channel = $Channel description = $Description } if ($Filter) { $body['filter'] = $Filter } $params = @{ Uri = '{0}/_apis/notification/subscriptions?api-version={1}' -f $ApiUri.TrimEnd('/'), $ApiVersion Method = 'POST' ContentType = 'application/json' Body = $body | ConvertTo-Json -Depth 10 } try { return Invoke-AzDevOpsApiRestMethod @params } catch { Throw "[New-DevOpsNotificationSubscription] Failed to create notification subscription: $_" } } |