This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using Microsoft.IdentityModel.JsonWebTokens; | |
using Nito.AsyncEx; | |
namespace YourProject | |
{ | |
public interface IAtlassianOAuthCredentialsManager |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Net; | |
using System.Net.Http; | |
using System.Net.Http.Headers; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace YourProject |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Net.Http; | |
using System.Threading.Tasks; | |
using Atlassian.Jira; | |
using Microsoft.ApplicationInsights.Extensibility; | |
using Microsoft.AspNetCore.Http; | |
using Microsoft.AspNetCore.Http.Features; | |
using Microsoft.Extensions.DependencyInjection; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Remove-AzDServiceHook { | |
[CmdletBinding(DefaultParameterSetName = "ProjectName")] | |
param( | |
[Parameter(ParameterSetName = "ProjectId", ValueFromPipelineByPropertyName = $true)] | |
[Parameter(ParameterSetName = "ProjectName", ValueFromPipelineByPropertyName = $true)] | |
[ValidateSet($null, "git.push","git.pullrequest.created","git.pullrequest.updated","build.complete")] | |
[string] $EventType = $null, | |
[Parameter(ParameterSetName = "ProjectId", ValueFromPipelineByPropertyName = $true)] | |
[Parameter(ParameterSetName = "ProjectName", ValueFromPipelineByPropertyName = $true)] | |
[string] $ToUrl = $null, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Update-AzDServiceHook { | |
param( | |
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] | |
[Microsoft.VisualStudio.Services.ServiceHooks.WebApi.Subscription] $Subscription, | |
[Parameter(ValueFromPipelineByPropertyName = $true)] | |
[switch] $Enable, | |
[Parameter(ValueFromPipelineByPropertyName = $true)] | |
[switch] $Disable | |
) | |
if($Enable) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function New-AzDServiceHook { | |
[CmdletBinding(DefaultParameterSetName = "ProjectName")] | |
param( | |
[Parameter(Mandatory = $true, ParameterSetName = "ProjectId", ValueFromPipelineByPropertyName = $true)] | |
[string] $ProjectId, | |
[Parameter(Mandatory = $true, ParameterSetName = "ProjectName", ValueFromPipelineByPropertyName = $true)] | |
[string] $ProjectName, | |
[Parameter(Mandatory = $true, ParameterSetName = "ProjectId", ValueFromPipelineByPropertyName = $true)] | |
[Parameter(Mandatory = $true, ParameterSetName = "ProjectName", ValueFromPipelineByPropertyName = $true)] | |
[ValidateSet("git.push","git.pullrequest.created","git.pullrequest.updated","build.complete")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-AzDServiceHook { | |
[CmdletBinding(DefaultParameterSetName = "ProjectName")] | |
param( | |
[Parameter(ParameterSetName = "ProjectName", ValueFromPipelineByPropertyName = $true)] | |
[string] $ProjectName = $null, | |
[Parameter(ParameterSetName = "ProjectId", ValueFromPipelineByPropertyName = $true)] | |
[string] $ProjectId = $null, | |
[Parameter(ValueFromPipelineByPropertyName = $true)] | |
[ValidateSet("git.push","git.pullrequest.created","git.pullrequest.updated","build.complete")] | |
[string] $EventType = $null, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# see https://docs.microsoft.com/en-us/azure/devops/integrate/concepts/dotnet-client-libraries?view=azure-devops | |
# for links to some of the nuget packages which contain these (this code was written against version 15.131.1) | |
Add-Type -Path "C:\YourPath\Newtonsoft.Json.dll" | |
Add-Type -Path "C:\YourPath\Microsoft.TeamFoundation.Client.dll" | |
Add-Type -Path "C:\YourPath\System.Net.Http.Formatting.dll" | |
Add-Type -Path "C:\YourPath\Microsoft.VisualStudio.Services.Common.dll" | |
Add-Type -Path "C:\YourPath\Microsoft.VisualStudio.WebApi.dll" | |
Add-Type -Path "C:\YourPath\Microsoft.VisualStudio.Services.ServiceHooks.dll" | |
$pat = "your-personal-access-token" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Threading.Tasks; | |
using Microsoft.AspNetCore.Mvc; | |
using Microsoft.Extensions.Logging; | |
namespace YourNamespace | |
{ | |
[ApiController] | |
[Route("[controller]")] | |
public class YourController : ControllerBase | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.ApplicationInsights.Channel; | |
using Microsoft.ApplicationInsights.DataContracts; | |
using Microsoft.ApplicationInsights.Extensibility; | |
using Microsoft.AspNetCore.Http; | |
namespace YourNamespace | |
{ | |
// https://stackoverflow.com/questions/42686363/view-post-request-body-in-application-insights | |
public class TrackRequestBodyInitializer : ITelemetryInitializer | |
{ |