├── .github ├── ISSUE_TEMPLATE.md └── workflows │ └── test.yml ├── .gitignore ├── .travis.yml.old ├── LICENSE ├── PSGitLab ├── PSGitLab.Format.ps1xml ├── PSGitLab.psd1 ├── PSGitLab.psm1 ├── Private │ ├── DecryptString.ps1 │ ├── DownloadFromGitLabAPI.ps1 │ ├── FormatCommits.ps1 │ ├── GetGitLabStatusCode.ps1 │ ├── GetMethodParameters.ps1 │ ├── GetVisibilityLevel.ps1 │ ├── GetWeek.ps1 │ ├── ImportConfig.ps1 │ └── QueryGitLabAPI.ps1 └── Public │ ├── Build │ └── New-GitLabBuild.ps1 │ ├── Configuration │ ├── Get-GitLabSetting.ps1 │ ├── Get-GitLabVersion.ps1 │ ├── Save-GitLabAPIConfiguration.ps1 │ └── Test-GitLabAPI.ps1 │ ├── Groups │ ├── Get-GitLabGroup.ps1 │ └── New-GitLabGroup.ps1 │ ├── Issues │ └── Get-GitLabIssue.ps1 │ ├── Keys │ ├── Get-GitLabUserKey.ps1 │ ├── New-GitLabUserKey.ps1 │ ├── Push-SSHKeysToGitLab.ps1 │ └── Remove-GitLabUserKey.ps1 │ ├── MergeRequests │ ├── Close-GitLabMergeRequest.ps1 │ ├── Get-GitLabMergeRequest.ps1 │ ├── New-GitLabMergeRequest.ps1 │ ├── Remove-GitLabMergeRequest.ps1 │ └── Set-GitLabMergeRequest.ps1 │ ├── Milestones │ ├── Close-GitLabMilestone.ps1 │ ├── Get-GitLabMilestone.ps1 │ ├── New-GitLabMilestone.ps1 │ └── Set-GitLabMilestone.ps1 │ ├── Namespaces │ └── Get-GitLabNamespace.ps1 │ ├── Projects │ ├── Get-GitLabPipeline.ps1 │ ├── Get-GitLabProject.ps1 │ ├── Get-GitLabProjectArchive.ps1 │ ├── Get-GitLabProjectCommit.ps1 │ ├── Get-GitLabProjectEvent.ps1 │ ├── Get-GitLabProjectServiceMSTeams.ps1 │ ├── Get-GitLabProjectServiceSlack.ps1 │ ├── Get-GitLabProjectSubmodule.ps1 │ ├── Get-GitLabProjectTag.ps1 │ ├── Get-GitLabProjectWebhook.ps1 │ ├── Get-GitlabProjectRepositoryTree.ps1 │ ├── New-GitLabFork.ps1 │ ├── New-GitLabProject.ps1 │ ├── New-GitLabProjectWebhook.ps1 │ ├── Remove-GitLabProject.ps1 │ ├── Remove-GitLabProjectServiceMSTeams.ps1 │ ├── Remove-GitLabProjectServiceSlack.ps1 │ ├── Remove-GitLabProjectWebhook.ps1 │ ├── Restart-GitLabPipeline.ps1 │ ├── Set-GitLabProject.ps1 │ ├── Set-GitLabProjectServiceMSTeams.ps1 │ ├── Set-GitLabProjectServiceSlack.ps1 │ ├── Set-GitLabProjectWebhook.ps1 │ ├── Start-GitLabPipeline.ps1 │ └── Stop-GitLabPipeline.ps1 │ ├── Runners │ ├── Add-GitLabProjectRunner.ps1 │ ├── Get-GitLabRunner.ps1 │ ├── New-GitLabRunner.ps1 │ ├── Remove-GitLabProjectRunner.ps1 │ ├── Remove-GitLabRunner.ps1 │ └── Set-GitLabRunner.ps1 │ ├── Statistics │ └── Get-GitLabCommitStats.ps1 │ └── User │ ├── Block-GitLabUser.ps1 │ ├── Get-GitLabUser.ps1 │ ├── New-GitLabUser.ps1 │ ├── Remove-GitLabUser.ps1 │ ├── Search-GitLabUser.ps1 │ ├── Set-GitLabUser.ps1 │ └── Unblock-GitLabUser.ps1 ├── README.md ├── ReleaseNotes.md ├── Tests ├── Configuration.PSGitLab.Tests.ps1 ├── Generic.Tests.ps1 ├── Integration │ ├── Install.ps1 │ └── User.Tests.ps1 ├── PSGitLab.Tests.ps1 └── Projects.PSGitLab.Tests.ps1 ├── appveyor.yml.old ├── build.ps1 ├── docker ├── docker-compose.yml ├── docker-entrypoint ├── init └── test.rb ├── docs ├── Add-GitLabProjectRunner.md ├── Block-GitLabUser.md ├── Close-GitLabMergeRequest.md ├── Close-GitLabMilestone.md ├── Get-GItLabSetting.md ├── Get-GitLabCommitStats.md ├── Get-GitLabGroup.md ├── Get-GitLabIssue.md ├── Get-GitLabMergeRequest.md ├── Get-GitLabMilestone.md ├── Get-GitLabNamespace.md ├── Get-GitLabPipeline.md ├── Get-GitLabProject.md ├── Get-GitLabProjectArchive.md ├── Get-GitLabProjectCommit.md ├── Get-GitLabProjectEvent.md ├── Get-GitLabProjectServiceMSTeams.md ├── Get-GitLabProjectServiceSlack.md ├── Get-GitLabProjectTag.md ├── Get-GitLabProjectWebhook.md ├── Get-GitLabRunner.md ├── Get-GitLabUser.md ├── Get-GitLabUserKey.md ├── Get-GitLabVersion.md ├── Get-GitlabProjectRepositoryTree.md ├── Get-GitlabProjectSubmodule.md ├── New-GitLabBuild.md ├── New-GitLabFork.md ├── New-GitLabGroup.md ├── New-GitLabMergeRequest.md ├── New-GitLabMilestone.md ├── New-GitLabProject.md ├── New-GitLabProjectWebhook.md ├── New-GitLabRunner.md ├── New-GitLabUser.md ├── New-GitLabUserKey.md ├── Push-SSHKeysToGitLab.md ├── Remove-GitLabMergeRequest.md ├── Remove-GitLabProject.md ├── Remove-GitLabProjectRunner.md ├── Remove-GitLabProjectServiceMSTeams.md ├── Remove-GitLabProjectServiceSlack.md ├── Remove-GitLabProjectWebhook.md ├── Remove-GitLabRunner.md ├── Remove-GitLabUser.md ├── Remove-GitLabUserKey.md ├── Restart-GitLabPipeline.md ├── Save-GitLabAPIConfiguration.md ├── Search-GitLabUser.md ├── Set-GitLabMergeRequest.md ├── Set-GitLabMilestone.md ├── Set-GitLabProject.md ├── Set-GitLabProjectServiceMSTeams.md ├── Set-GitLabProjectServiceSlack.md ├── Set-GitLabProjectWebhook.md ├── Set-GitLabRunner.md ├── Set-GitLabUser.md ├── Start-GitLabPipeline.md ├── Stop-GitLabPipeline.md ├── Test-GitLabAPI.md └── Unblock-GitLabUser.md ├── module.psdeploy.ps1 ├── psgitlab.build.ps1 ├── run-tests.ps1 └── runTests.sh /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## 1. Provide a general summary of the issue in the Title above 2 | 3 | ## 2. Describe Your Environment 4 | Operating System and PowerShell version: 5 | 6 | ## 3. Expected Behavior 7 | [comment] If you're describing a bug, tell us what should happen 8 | [comment] If you're suggesting a change/improvement, tell us how it should work 9 | 10 | ## 4.Current Behavior 11 | [comment] If describing a bug, tell us what happens instead of the expected behavior 12 | [comment] If suggesting a change/improvement, explain the difference from current behavior 13 | 14 | ## 5. Possible Solution 15 | [comment] Have a solution in mind? 16 | 17 | ## 6. Context 18 | [Comment] How has this issue affected you? What are you trying to accomplish? 19 | 20 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Docker Image CI 2 | 3 | on: [push] 4 | 5 | jobs: 6 | 7 | build: 8 | env: 9 | GITHUB_ACTIONS: true 10 | 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/checkout@v2 15 | - name: Set Permissions 16 | run: chmod +x ./runTests.sh 17 | - name: Build the docker-compose and running tests 18 | run: ./runTests.sh -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Release/* 2 | Results/* 3 | docker/config/* -------------------------------------------------------------------------------- /.travis.yml.old: -------------------------------------------------------------------------------- 1 | sudo: required 2 | services: 3 | - docker 4 | env: 5 | COMPOSE_VERSION: 1.23.2 6 | 7 | before_install: 8 | - curl -L https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose 9 | - chmod +x docker-compose 10 | - sudo mv docker-compose /usr/local/bin 11 | 12 | script: 13 | - ./runTests.sh 14 | # dist: trusty 15 | # install: 16 | # - bash <(wget -O - https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/install-powershell.sh) 17 | # - pwsh --version 18 | # - pwsh -c "Install-Module Pester,PSScriptAnalyzer,Psake -Scope CurrentUser -force" 19 | # - pwsh ./Tests/Integration/Install.ps1 20 | # script: 21 | # - pwsh -c "Get-Module -ListAvailable; Import-Module Pester; Invoke-Pester -Tag 'Integration'" 22 | # notifications: 23 | # slack: 24 | # secure: u6tFFt48sbU3PtNh6DqQhoKYooyXljvDY5Q9vp5Udy4ezpAIGvA52VukMmdO4Gq9PlRTEDnkm1G9s/QrbLvcn7FCbZtCiEKK6NXvl15MlmRiLh2u3/A2dGtBYGb+7tt2YaCHcwhqfVW/aNK7PEMoJchWxvrpzXj5ORllU3XXmlAkK1/hWDhQT/VPrNlOB1XmRNYgoAfKinl2h8YQNsLLrtoHp3bKzN5/rvmnaNUUO1gVMZZxWhSGbJCtVTLHO9rWxrNqhpFH2BEihnTQJij89Zv4N7UsYJkCcVAGgtD256RJdvtJD59nYDb6ovRbjTqKYg/bxX9dipWXl3tJnAun2uM1zNMICwHsFr/aUxpjZZVe+WY7Se1V0+Eulyb5IwefWtbf2ljg5yZEgY3xltmcAX2k2AjYRADb1ThAPFdeYHTVcuHbpXQzjQs8w37prgjHh9BkEVBdg5UInbUHIv+ICq2m4Bd+Zf+kuwD7oijz011okAkGEQgqaXPv55N2KMOpZjh4bU4FpGeMlOGLYxHR1Aqr0KG62h6Xtjr4eloBPMSenSNAit1922EoZ0TmHUMyQiC0omqsYIqAT+G2FsRVGSzBLEh4EaRPVJ1cniISFG5Rz4sLj6UDF47VgnMDPbYKS3FXgrx1zYsqwHhwKwDNTGSbwoKIcnQUWq9dEHe1Sh4= 25 | # email: false -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Nicholas M. Getchell 4 | Copyright (c) 2016 Lampenwelt GmbH, Leonhard Schick 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | 24 | -------------------------------------------------------------------------------- /PSGitLab/PSGitLab.psm1: -------------------------------------------------------------------------------- 1 | #Get public and private function definition files. 2 | $Public = @( Get-ChildItem -Path $PSScriptRoot\Public\ -Include *.ps1 -Recurse -ErrorAction SilentlyContinue ) 3 | $Private = @( Get-ChildItem -Path $PSScriptRoot\Private\ -Include *.ps1 -Recurse -ErrorAction SilentlyContinue ) 4 | 5 | #Dot source the files 6 | Foreach($import in @($Public + $Private)) { 7 | Try { 8 | . $import.fullname 9 | } 10 | Catch { 11 | Write-Error -Message "Failed to import function $($import.fullname): $_" 12 | } 13 | } 14 | 15 | Export-ModuleMember -Function $Public.Basename 16 | -------------------------------------------------------------------------------- /PSGitLab/Private/DecryptString.ps1: -------------------------------------------------------------------------------- 1 | # https://blogs.msdn.microsoft.com/besidethepoint/2010/09/21/decrypt-secure-strings-in-powershell/ 2 | function DecryptString { 3 | param( 4 | [Parameter(ValueFromPipeline=$true,Mandatory=$true,Position=0)] 5 | [System.Security.SecureString] 6 | $Token 7 | ) 8 | 9 | $marshal = [System.Runtime.InteropServices.Marshal] 10 | $ptr = $marshal::SecureStringToBSTR( $token ) 11 | $key = $marshal::PtrToStringBSTR( $ptr ) 12 | $marshal::ZeroFreeBSTR( $ptr ) 13 | $key 14 | Remove-Variable key 15 | } 16 | -------------------------------------------------------------------------------- /PSGitLab/Private/DownloadFromGitLabAPI.ps1: -------------------------------------------------------------------------------- 1 | Function DownloadFromGitLabAPI 2 | { 3 | <# 4 | .SYNOPSIS 5 | Download file from GitLab API 6 | 7 | .DESCRIPTION 8 | Download file from GitLab API 9 | 10 | .PARAMETER RequestURI 11 | The URL for download. 12 | 13 | .PARAMETER OutFile 14 | Where to save the file. 15 | 16 | .EXAMPLE 17 | DownloadFromGitLabAPI -RequestURI /projects/1/repository/archive.zip -OutFile C:\Temp\temp.zip 18 | Downloads the whole repo in a zip file for project id 1 19 | .NOTES 20 | 21 | .LINK 22 | 23 | .INPUTS 24 | 25 | .OUTPUTS 26 | 27 | #> 28 | 29 | 30 | [cmdletbinding()] 31 | param( 32 | [Parameter(Mandatory, 33 | HelpMessage = 'URI', 34 | Position = 0)] 35 | [ValidateNotNullOrEmpty()] 36 | [String]$RequestURI, 37 | 38 | [Parameter(Mandatory, 39 | HelpMessage = 'Output File', 40 | Position = 1)] 41 | [string]$OutFile 42 | ) 43 | $GitLabConfig = ImportConfig 44 | $Domain = $GitLabConfig.Domain 45 | if ( $IsWindows -or ( [version]$PSVersionTable.PSVersion -lt [version]'5.99.0' ) ) 46 | { 47 | $Token = DecryptString -Token $GitLabConfig.Token 48 | } 49 | elseif ( $IsLinux ) 50 | { 51 | $Token = $GitLabConfig.Token 52 | } 53 | 54 | $RequestURI = ('{0}/api/v3{1}' -f $Domain, $RequestURI) 55 | try 56 | { 57 | Write-Verbose -Message ('URL: {0}' -f $RequestURI) 58 | $wc = New-Object -TypeName System.Net.WebClient 59 | $wc.Headers.Add('PRIVATE-TOKEN',$Token) 60 | Write-Verbose -Message ('Downloading File from {0} to {1}' -f $RequestURI, $OutFile) 61 | $wc.DownloadFile($RequestURI,$OutFile) 62 | Remove-Variable -Name Token 63 | Remove-Variable -Name RequestURI 64 | } 65 | catch 66 | { 67 | $ErrorMessage = $_.exception.response.statusDescription 68 | Write-Warning -Message ('{0}. See {1}/help/api/README.md#status-codes for more information.' -f $ErrorMessage, $Domain) 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /PSGitLab/Private/GetGitLabStatusCode.ps1: -------------------------------------------------------------------------------- 1 | Function GetGitLabStatusCode { 2 | param( 3 | [Parameter(Mandatory=$true)] 4 | [int]$StatusCode 5 | ) 6 | 7 | switch ($StatusCode) { 8 | '200' { $Text = 'OK - The GET, PUT or DELETE request was successful, the resource(s) itself is returned as JSON' } 9 | '201' { $Text = 'Created - The POST request was successful and the resource is returned as JSON' } 10 | '204' { $Text = 'The server has successfully fulfilled the request and that there is no additional content to send in the response payload body.'} 11 | '304' { $Text = 'Indicates that the resource has not been modified since the last request.'} 12 | '400' { $Text = 'Bad Request - A required attribute of the API request is missing, e.g. the title of an issue is not given' } 13 | '401' { $Text = 'Unauthorized - The user is not authenticated, a valid user token is necessary, see above' } 14 | '403' { $Text = 'Forbidden - The request is not allowed, e.g. the user is not allowed to delete a project' } 15 | '404' { $Text = 'Not Found - A resource could not be accessed, e.g. an ID for a resource could not be found' } 16 | '405' { $Text = 'Method Not Allowed - The request is not supported' } 17 | '409' { $Text = 'Conflict - A conflicting resource already exists, e.g. creating a project with a name that already exists' } 18 | '412' { $Text = 'Indicates the request was denied. May happen if the If-Unmodified-Since header is provided when trying to delete a resource, which was modified in between.'} 19 | '422' { $Text = 'Unprocessable - The entity could not be processed' } 20 | '500' { $Text = 'Server Error - While handling the request something went wrong on the server side' } 21 | } 22 | 23 | $Return = [pscustomobject]@{ 24 | StatusCode = $StatusCode; 25 | StatusText = $Text; 26 | } 27 | $Return.pstypenames.insert(0,'PSGitLab.Configuration.StatusCode') 28 | Write-Output $Return 29 | } 30 | -------------------------------------------------------------------------------- /PSGitLab/Private/GetMethodParameters.ps1: -------------------------------------------------------------------------------- 1 | Function GetMethodParameters { 2 | [cmdletbinding()] 3 | param( 4 | $GetURLParameters 5 | ) 6 | 7 | $string = '?' 8 | foreach ($Param in $GetUrlParameters) { 9 | $Param.Keys | ForEach-Object { 10 | $key = $_ 11 | $value = $Param[$_] 12 | } 13 | $string += "&" 14 | $string += [uri]::EscapeDataString($key) 15 | $string += "=" 16 | $string += [uri]::EscapeDataString($value) 17 | } 18 | $string = $string -replace '\?&','?' 19 | Write-Output $string 20 | } 21 | -------------------------------------------------------------------------------- /PSGitLab/Private/GetVisibilityLevel.ps1: -------------------------------------------------------------------------------- 1 | function GetVisibilityLevel { 2 | param( 3 | [ValidateSet("Public", "Internal", "Private")] 4 | $String 5 | ) 6 | 7 | switch ($String) 8 | { 9 | 'Public' { 20; break; } 10 | 'Internal' { 10; break; } 11 | 'Private' { 0; break; } 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /PSGitLab/Private/GetWeek.ps1: -------------------------------------------------------------------------------- 1 | function GetWeek([datetime]$DateTime = (Get-Date)) { 2 | $cultureInfo = [System.Globalization.CultureInfo]::CurrentCulture 3 | $cultureInfo.Calendar.GetWeekOfYear($DateTime,$cultureInfo.DateTimeFormat.CalendarWeekRule,$cultureInfo.DateTimeFormat.FirstDayOfWeek) 4 | } 5 | -------------------------------------------------------------------------------- /PSGitLab/Private/ImportConfig.ps1: -------------------------------------------------------------------------------- 1 | Function ImportConfig { 2 | <# 3 | .Synopsis 4 | Check for configuration and output the information. 5 | .DESCRIPTION 6 | Check for configuration and output the information. Goes into the $env:appdata for the configuration file. 7 | .EXAMPLE 8 | ImportConfig 9 | #> 10 | 11 | if ( ( $null -ne $env:PSGitLabDomain) -and ( $null -ne $env:PSGitLabToken ) -and ( $null -ne $env:PSGitLabAPIVersion ) ) { 12 | $Token = ConvertTo-SecureString -String $env:PSGitLabToken -AsPlainText -Force 13 | [PSCustomObject]@{ 14 | Domain=$env:PSGitLabDomain 15 | Token=$Token 16 | APIVersion=$env:PSGitLabAPIVersion 17 | } 18 | break; 19 | } 20 | 21 | if ( $IsWindows -or ( [version]$PSVersionTable.PSVersion -lt [version]"5.99.0" ) ) { 22 | $ConfigFile = "{0}\PSGitLab\PSGitLabConfiguration.xml" -f $env:appdata 23 | } elseif ( $IsLinux -or $IsMacOS ) { 24 | $ConfigFile = "{0}/.psgitlab/PSGitLabConfiguration.xml" -f $HOME 25 | } else { 26 | Write-Error "Unknown Platform" 27 | } 28 | if (Test-Path $ConfigFile) { 29 | Import-Clixml $ConfigFile 30 | 31 | } else { 32 | Write-Warning 'No saved configuration information. Run Save-GitLabAPIConfiguration.' 33 | break; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /PSGitLab/Public/Build/New-GitLabBuild.ps1: -------------------------------------------------------------------------------- 1 | Function New-GitLabBuild { 2 | [cmdletbinding()] 3 | param( 4 | [ValidateNotNullOrEmpty()] 5 | [Parameter(ParameterSetName="Default",Mandatory=$true)] 6 | [Parameter(ParameterSetName="Variable",Mandatory=$true)] 7 | [int]$ProjectId, 8 | [ValidateNotNullOrEmpty()] 9 | [Parameter(ParameterSetName="Default",Mandatory=$true)] 10 | [Parameter(ParameterSetName="Variable",Mandatory=$true)] 11 | [string]$Reference, 12 | [ValidateNotNullOrEmpty()] 13 | [Parameter(ParameterSetName="Default",Mandatory=$true)] 14 | [Parameter(ParameterSetName="Variable",Mandatory=$true)] 15 | [string]$token, 16 | [Parameter(ParameterSetName="Variable",Mandatory=$true)] 17 | [string]$Variable, 18 | [Parameter(ParameterSetName="Variable",Mandatory=$true)] 19 | [string]$Value 20 | ) 21 | $LF = "`r`n" 22 | $uri = "http://gitlab.columbia.csc/api/v3/projects/$ProjectId/trigger/builds" 23 | $boundary = [System.Guid]::NewGuid().ToString() 24 | 25 | $bodyLines = 26 | "--$boundary$LF" + 27 | "Content-Disposition: form-data; name=`"token`"$LF" + 28 | "Content-Type: 'multipart/form-data'$LF$LF" + 29 | "$token$LF" + 30 | "--$boundary$LF" + 31 | "Content-Disposition: form-data; name=`"ref`"$LF" + 32 | "Content-Type: 'multipart/form-data'$LF$LF" + 33 | "$Reference$LF" 34 | 35 | if ($Variable) { 36 | $Variable = "variables[$Variable]" 37 | $bodyLines += 38 | ("--$boundary$LF" + 39 | "Content-Disposition: form-data; name=`"$Variable`"$LF" + 40 | "Content-Type: multipart/form-data$LF$LF" + 41 | "$Value$LF") 42 | } 43 | $bodyLines += "--$boundary--$LF" 44 | 45 | try { 46 | $result = Invoke-RestMethod -Uri $uri -Method Post -ContentType "multipart/form-data; boundary=`"$boundary`"" -Body $bodyLines 47 | Write-Debug $result 48 | Write-Output "Build trigger sent successfully" 49 | } 50 | catch { 51 | Write-Output ($x.ErrorDetails.Message | convertfrom-json).message 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /PSGitLab/Public/Configuration/Get-GitLabSetting.ps1: -------------------------------------------------------------------------------- 1 | Function Get-GitLabSetting { 2 | [cmdletbinding()] 3 | [OutputType('GitLab.Setting')] 4 | param( 5 | ) 6 | $Request = @{ 7 | URI="/application/settings"; 8 | Method='Get'; 9 | } 10 | 11 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Setting' 12 | 13 | } 14 | -------------------------------------------------------------------------------- /PSGitLab/Public/Configuration/Get-GitLabVersion.ps1: -------------------------------------------------------------------------------- 1 | Function Get-GitLabVersion 2 | { 3 | [OutputType('GitLab.Version')] 4 | [cmdletbinding()] 5 | param( 6 | ) 7 | 8 | BEGIN {} 9 | 10 | PROCESS { 11 | Write-Verbose ( $PSBoundParameters | ConvertTo-Json ) 12 | 13 | $Request = @{ 14 | URI = "/version" 15 | Method = 'GET' 16 | } 17 | 18 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Version' 19 | } 20 | 21 | END {} 22 | 23 | } 24 | -------------------------------------------------------------------------------- /PSGitLab/Public/Configuration/Save-GitLabAPIConfiguration.ps1: -------------------------------------------------------------------------------- 1 | Function Save-GitLabAPIConfiguration { 2 | [cmdletbinding()] 3 | param( 4 | [Parameter(Mandatory=$true, 5 | HelpMessage='You can find the token in your profile.', 6 | Position=0)] 7 | [ValidateNotNullOrEmpty()] 8 | $Token, 9 | 10 | [Parameter(Mandatory=$true, 11 | HelpMessage='Please provide a URI to the GitLab installation', 12 | Position=1)] 13 | [ValidateNotNullOrEmpty()] 14 | [ValidatePattern("^(?:http|https):\/\/(?:[\w\.\-\+]+:{0,1}[\w\.\-\+]*@)?(?:[a-z0-9\-\.]+)(?::[0-9]+)?(?:\/|\/(?:[\w#!:\.\?\+=&%@!\-\/\(\)]+)|\?(?:[\w#!:\.\?\+=&%@!\-\/\(\)]+))?$")] 15 | $Domain, 16 | 17 | $APIVersion = 4 18 | ) 19 | 20 | if ( $Domain -match '^http:\/\/' ) { 21 | Write-Warning "All tokens will be sent over HTTP. Recommendation: Use HTTPS." 22 | } 23 | 24 | if ( $IsWindows -or ( [version]$PSVersionTable.PSVersion -lt [version]"5.99.0" ) ) { 25 | 26 | $Parameters = @{ 27 | Token=(ConvertTo-SecureString -string $Token -AsPlainText -Force) 28 | Domain=$Domain; 29 | APIVersion=$APIVersion; 30 | } 31 | 32 | $ConfigFile = "$env:appdata\PSGitLab\PSGitLabConfiguration.xml" 33 | 34 | } elseif ( $IsLinux -or $IsMacOS ) { 35 | 36 | Write-Warning "Warning: Your GitLab token will be stored in plain-text on non-Windows platforms." 37 | 38 | $Parameters = @{ 39 | Token=$Token 40 | Domain=$Domain; 41 | APIVersion=$APIVersion; 42 | } 43 | 44 | $ConfigFile = "{0}/.psgitlab/PSGitLabConfiguration.xml" -f $HOME 45 | 46 | } else { 47 | Write-Error "Unknown Platform" 48 | } 49 | if (-not (Test-Path (Split-Path $ConfigFile))) { 50 | New-Item -ItemType Directory -Path (Split-Path $ConfigFile) | Out-Null 51 | 52 | } 53 | $Parameters | Export-Clixml -Path $ConfigFile 54 | Remove-Variable Parameters 55 | } 56 | -------------------------------------------------------------------------------- /PSGitLab/Public/Configuration/Test-GitLabAPI.ps1: -------------------------------------------------------------------------------- 1 | Function Test-GitLabAPI { 2 | param( 3 | [Parameter(Mandatory=$false)] 4 | [string]$Version = 'v3' 5 | ) 6 | $GitLabConfig = ImportConfig 7 | 8 | if ($GitLabConfig.APIVersion) { $Version = "v$($GitLabConfig.APIVersion)" } 9 | 10 | $Domain = $GitLabConfig.Domain 11 | 12 | if ( $isWindows -or ( [version]$PSVersionTable.PSVersion -lt [version]"5.99.0") ) { 13 | 14 | $Token = DecryptString -Token $GitLabConfig.Token 15 | } elseif ( $isLinux -or $IsMacOS ) { 16 | $Token = $GitLabConfig.Token 17 | } 18 | 19 | try { 20 | #https://docs.microsoft.com/en-us/dotnet/api/system.net.securityprotocoltype?view=netcore-2.0#System_Net_SecurityProtocolType_SystemDefault 21 | if ($PSVersionTable.PSVersion.Major -lt 6 -and [Net.ServicePointManager]::SecurityProtocol -notmatch 'Tls12') { 22 | [Net.ServicePointManager]::SecurityProtocol += [Net.SecurityProtocolType]::Tls12 23 | } 24 | } 25 | catch { 26 | Write-Warning -Message 'Adding TLS 1.2 to supported security protocols was unsuccessful.' 27 | } 28 | 29 | $Result = Invoke-WebRequest -UseBasicParsing -Uri "$Domain/api/$Version/projects?private_token=$Token" 30 | Remove-Variable Token 31 | GetGitLabStatusCode $Result.StatusCode 32 | } 33 | -------------------------------------------------------------------------------- /PSGitLab/Public/Groups/New-GitLabGroup.ps1: -------------------------------------------------------------------------------- 1 | Function New-GitLabGroup 2 | { 3 | [cmdletbinding(DefaultParameterSetName = 'Groups')] 4 | [OutputType("GitLab.Group")] 5 | param( 6 | [Parameter(Mandatory = $true)] 7 | $Name, 8 | 9 | [Parameter(Mandatory = $true)] 10 | $Path, 11 | 12 | [Parameter(Mandatory = $false)] 13 | $Description, 14 | 15 | [Parameter(Mandatory = $false)] 16 | [ValidateSet("public", "internal", "private")] 17 | $Visibility = 'private', 18 | 19 | [Parameter(Mandatory = $false)] 20 | $Parent_Id 21 | ) 22 | 23 | 24 | $Body = @{ 25 | name = $Name 26 | path = $Path 27 | visibility = $Visibility 28 | } 29 | 30 | if($Description -ne $null ) { $Body.Add('description',$Description) } 31 | if($Parent_Id -ne $null ) { $Body.Add('parent_id',$Parent_Id) } 32 | 33 | $Request = @{ 34 | URI = '/groups' 35 | Method = 'POST' 36 | Body = $Body 37 | } 38 | 39 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Group' 40 | } 41 | -------------------------------------------------------------------------------- /PSGitLab/Public/Issues/Get-GitLabIssue.ps1: -------------------------------------------------------------------------------- 1 | Function Get-GitLabIssue { 2 | [cmdletbinding(DefaultParameterSetName='User')] 3 | [OutputType('GitLab.Issue')] 4 | param( 5 | [Parameter(ParameterSetName='GroupID')] 6 | [Int]$GroupID, 7 | 8 | [Parameter(ParameterSetName='User')] 9 | [Parameter(ParameterSetName='GroupID')] 10 | [ValidateSet('All','CreatedByMe','AssignedToMe')] 11 | [String]$Scope, 12 | 13 | [Parameter(ParameterSetName='User')] 14 | [Parameter(ParameterSetName='GroupID')] 15 | [ValidateSet("opened", "closed")] 16 | [String]$State 17 | ) 18 | 19 | $Request = @{ 20 | URI = '/issues' 21 | Method = 'GET' 22 | } 23 | 24 | # https://docs.gitlab.com/ee/api/issues.html 25 | 26 | $GetUrlParameters = @() 27 | 28 | if($State) 29 | { 30 | $GetUrlParameters += @{state=$State} 31 | } 32 | 33 | if($Scope) 34 | { 35 | # Set the expected API value for the scope. Kebab case will change in Gitlab 11. 36 | if($Scope -eq 'CreatedByMe') { 37 | $GetUrlParameters += @{scope='created-by-me'} 38 | } 39 | elseif($Scope -eq 'AssignedToMe') { 40 | $GetUrlParameters += @{scope='assigned-to-me'} 41 | } 42 | elseif($Scope -eq 'all') { 43 | $GetUrlParameters += @{scope='all'} 44 | } 45 | else { 46 | } 47 | } 48 | else { 49 | # Defaults to issues 'created' by the user. 50 | } 51 | 52 | $URLParameters = GetMethodParameters -GetURLParameters $GetUrlParameters 53 | 54 | switch($PSCmdlet.ParameterSetName) { 55 | 'GroupID' { $Request.URI = "/groups/$GroupID/issues$URLParameters"; break; } 56 | 'User' { $Request.URI = "/issues$URLParameters"; break; } 57 | } 58 | 59 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Issue' 60 | } -------------------------------------------------------------------------------- /PSGitLab/Public/Keys/Get-GitLabUserKey.ps1: -------------------------------------------------------------------------------- 1 | Function Get-GitLabUserKey { 2 | 3 | [cmdletbinding(DefaultParameterSetName='All')] 4 | [OutputType('GitLab.User.Key')] 5 | param( 6 | [Parameter(ParameterSetName='All')] 7 | [switch]$All, 8 | 9 | [Parameter(ParameterSetName='Key')] 10 | [int]$Key, 11 | 12 | [Parameter(ParameterSetName='Username')] 13 | [string]$Username, 14 | 15 | [Parameter(ParameterSetName='UserID')] 16 | [int]$UserId 17 | 18 | ) 19 | 20 | $Request = @{ 21 | URI=""; 22 | Method='Get'; 23 | } 24 | 25 | if ( $PSCmdlet.ParameterSetName -eq 'Username' ) { 26 | $UserID = Get-GitLabUser -Username $Username | Select-Object -ExpandProperty Id -First 1 27 | } 28 | 29 | switch ( $PSCmdlet.ParameterSetName) { 30 | 'Key' { $Request.URI = "/user/keys/$Key" } 31 | 'All' { $Request.URI = "/user/keys/" } 32 | 'Username' { $Request.URI = "/users/$UserID/keys" } 33 | 'UserID' { $Request.URI = "/users/$UserID/keys" } 34 | } 35 | 36 | 37 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.User.Key' 38 | } 39 | -------------------------------------------------------------------------------- /PSGitLab/Public/Keys/New-GitLabUserKey.ps1: -------------------------------------------------------------------------------- 1 | Function New-GitLabUserKey { 2 | [cmdletbinding(DefaultParameterSetName='Explicit')] 3 | [OutputType('GitLab.User.Key')] 4 | param( 5 | [Parameter(ParameterSetName='Explicit')] 6 | [string]$Title, 7 | 8 | [Parameter(ParameterSetName='Explicit',Mandatory=$true)] 9 | [string]$Key, 10 | 11 | [Parameter(ParameterSetName='File',Mandatory=$true)] 12 | [string]$KeyFile = $null, 13 | 14 | [Parameter(Mandatory=$false)] 15 | $Username = $null 16 | ) 17 | 18 | if ( $PSBoundParameters.ContainsKey('Username') ) { 19 | try { 20 | $User = Get-GitLabUser -Username $Username 21 | } catch { 22 | Write-Error "Unable to find user" 23 | } 24 | $URI = '/users/{0}/keys' -f $User.ID 25 | } else { 26 | $URI = "/user/keys" 27 | } 28 | 29 | if ( $PSCmdlet.ParameterSetName -eq 'File' ) { 30 | $Contents = Get-Content -Path $KeyFile 31 | $Title = ($Contents -split " ")[2] 32 | $Key = "{0} {1}" -f ($Contents -split " ")[0],($Contents -split " ")[1] 33 | 34 | Write-Verbose "Title: $Title Key: $Key" 35 | } 36 | 37 | if ($Title -eq $null) { 38 | Write-Error "Title could not be determined." 39 | } 40 | 41 | $Body = @{ 42 | title= $Title 43 | key = $Key 44 | } 45 | 46 | $Request = @{ 47 | URI=$URI; 48 | Method='POST' 49 | Body = $Body 50 | } 51 | 52 | 53 | 54 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.User.Key' 55 | } 56 | -------------------------------------------------------------------------------- /PSGitLab/Public/Keys/Push-SSHKeysToGitLab.ps1: -------------------------------------------------------------------------------- 1 | Function Push-SSHKeysToGitLab { 2 | [cmdletbinding(SupportsShouldProcess=$true,ConfirmImpact='High')] 3 | param( 4 | [ValidateScript({ Test-Path $_ })] 5 | $SSHDirectory = "~/.ssh/" 6 | ) 7 | 8 | $PublicKeyFiles = Get-Childitem -Recurse -Path $SSHDirectory -Include "*.pub" 9 | 10 | if ($PublicKeyFiles.count -gt 0 ) { 11 | 12 | $PublicKeyFiles | ForEach-Object { 13 | if ( $PSCmdlet.ShouldProcess("Push SSH Key $_ to GitLab Instance") ) { 14 | Write-Verbose "Uploading $($_.Fullname)" 15 | New-GitLabUserKey -KeyFile $_.FullName 16 | } 17 | } 18 | 19 | } else { 20 | Write-Warning "No Public Keys Found" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /PSGitLab/Public/Keys/Remove-GitLabUserKey.ps1: -------------------------------------------------------------------------------- 1 | Function Remove-GitLabUserKey { 2 | [cmdletbinding(SupportsShouldProcess=$true)] 3 | [OutputType('GitLab.User.Key')] 4 | param( 5 | [Parameter(ParameterSetName='Id',Mandatory=$true)] 6 | [Parameter(ParameterSetName='User',Mandatory=$true)] 7 | [string]$Id, 8 | 9 | [Parameter(ParameterSetName='User',Mandatory=$true)] 10 | [string]$Username, 11 | 12 | [switch]$Passthru 13 | 14 | ) 15 | 16 | $Request = @{ 17 | URI=''; 18 | Method='DELETE'; 19 | } 20 | 21 | switch ( $PSCmdlet.ParameterSetName ) { 22 | 'User' { 23 | $UserId = (Get-GitLabUser -Username $Username).Id 24 | $Request.URI = "/users/$UserId/keys/$Id" 25 | } 26 | 'Id' { 27 | $Request.URI = "/user/keys/$Id" 28 | } 29 | } 30 | 31 | 32 | if ( $PSCmdlet.ShouldProcess("Delete SSH Key $Id") ) { 33 | $Results = QueryGitLabAPI -Request $Request -ObjectType 'GitLab.User.Key' 34 | if ( $Passthru ) { 35 | $Results 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /PSGitLab/Public/MergeRequests/Close-GitLabMergeRequest.ps1: -------------------------------------------------------------------------------- 1 | Function Close-GitLabMergeRequest { 2 | [cmdletbinding()] 3 | param( 4 | [Alias('project_id')] 5 | [ValidateNotNullOrEmpty()] 6 | [Parameter(ValueFromPipelineByPropertyName,Mandatory)] 7 | [string]$ProjectId, 8 | 9 | [ValidateNotNullOrEmpty()] 10 | [Parameter(ValueFromPipelineByPropertyName,Mandatory)] 11 | [string[]]$ID, 12 | 13 | [switch]$Passthru 14 | ) 15 | 16 | BEGIN {} 17 | 18 | PROCESS { 19 | 20 | foreach ( $MergeRequestID in $ID ) { 21 | $Results = Set-GitLabMergeRequest -Project $ProjectId -Id $ID -StateEvent close 22 | 23 | if ( $Passthru.isPresent ) { 24 | $Results 25 | } 26 | } 27 | } 28 | 29 | END {} 30 | 31 | } 32 | -------------------------------------------------------------------------------- /PSGitLab/Public/MergeRequests/Get-GitLabMergeRequest.ps1: -------------------------------------------------------------------------------- 1 | Function Get-GitLabMergeRequest { 2 | [cmdletbinding(DefaultParameterSetName='MergeRequests')] 3 | [OutputType('GitLab.MergeRequest')] 4 | param ( 5 | [ValidateNotNullOrEmpty()] 6 | [Parameter(ParameterSetName='Single',Mandatory)] 7 | [Parameter(ParameterSetName='MergeRequests',Mandatory)] 8 | [string]$ProjectId, 9 | 10 | [Parameter(ParameterSetName='Single',Mandatory)] 11 | [string]$Id, 12 | 13 | [Parameter(ParameterSetName='MergeRequests')] 14 | # merge request iid 15 | [string]$Iid, 16 | 17 | [Parameter(ParameterSetName='MergeRequests')] 18 | # possible values: all, merged, opened, closed 19 | [string]$State, 20 | 21 | [Parameter(ParameterSetName='MergeRequests')] 22 | # possible values: created_at (default) and updated_at 23 | [string]$OrderBy, 24 | 25 | [Parameter(ParameterSetName='MergeRequests')] 26 | # possible values: asc and desc (default) 27 | [string]$Sort 28 | 29 | ) 30 | $Project = Get-GitlabProject -Id $ProjectId; 31 | 32 | if($PSCmdlet.ParameterSetName -ne 'Single') { 33 | $GetUrlParameters = @() 34 | 35 | if ($Iid) { 36 | $GetUrlParameters += @{iid=$Id} 37 | } 38 | if ($State) { 39 | $GetUrlParameters += @{state=$State} 40 | } 41 | if ($OrderBy) { 42 | $GetUrlParameters += @{order_by=$OrderBy} 43 | } 44 | if ($Sort) { 45 | $GetUrlParameters += @{sort=$Sort} 46 | } 47 | 48 | $URLParameters = GetMethodParameters -GetURLParameters $GetUrlParameters 49 | } 50 | 51 | 52 | $Request = @{ 53 | URI = '' 54 | Method = 'GET' 55 | } 56 | 57 | Write-Verbose "Parameter Set Name: $($PSCmdlet.ParameterSetName)" 58 | 59 | switch ($PSCmdlet.ParameterSetName) { 60 | MergeRequests { $Request.URI="/projects/$($Project.id)/merge_requests$URLParameters"; break; } 61 | Single { $Request.URI="/projects/$($Project.id)/merge_requests/$Id"; break; } 62 | default { Write-Error "Incorrect parameter set."; break; } 63 | } 64 | 65 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.MergeRequest' 66 | } 67 | -------------------------------------------------------------------------------- /PSGitLab/Public/MergeRequests/New-GitLabMergeRequest.ps1: -------------------------------------------------------------------------------- 1 | Function New-GitLabMergeRequest { 2 | [cmdletbinding()] 3 | param( 4 | [ValidateNotNullOrEmpty()] 5 | [Parameter(Mandatory)] 6 | [string]$ProjectId, 7 | 8 | [ValidateNotNullOrEmpty()] 9 | [Parameter(Mandatory)] 10 | [string]$SourceBranch, 11 | 12 | [ValidateNotNullOrEmpty()] 13 | [Parameter(Mandatory)] 14 | [string]$TargetBranch, 15 | 16 | [int]$AssigneeId, 17 | 18 | [ValidateNotNullOrEmpty()] 19 | [Parameter(Mandatory)] 20 | [string]$Title, 21 | 22 | [string]$Description, 23 | 24 | [string]$TargetProjectId, 25 | 26 | [string]$Labels, 27 | 28 | [string]$MilestoneId, 29 | 30 | [switch]$RemoveSourceBranch 31 | ) 32 | 33 | $Project = $Project = Get-GitlabProject -Id $ProjectId; 34 | 35 | $GetUrlParameters = @() 36 | $GetUrlParameters += @{source_branch=$SourceBranch} 37 | $GetUrlParameters += @{target_branch=$TargetBranch} 38 | $GetUrlParameters += @{title=$Title} 39 | 40 | if ($AssigneeId) { 41 | $GetUrlParameters += @{assignee_id=$AssigneeId} 42 | } 43 | if ($Description) { 44 | $GetUrlParameters += @{description=$Description} 45 | } 46 | if ($TargetProjectId) { 47 | $GetUrlParameters += @{target_project_id=$TargetProjectId} 48 | } 49 | if ($Labels) { 50 | $GetUrlParameters += @{labels=$Labels} 51 | } 52 | if ($MilestoneId) { 53 | $GetUrlParameters += @{milestone_id=$MilestoneId} 54 | } 55 | if ($RemoveSourceBranch) { 56 | $GetUrlParameters += @{remove_source_branch=$true} 57 | } 58 | 59 | $URLParameters = GetMethodParameters -GetURLParameters $GetUrlParameters 60 | 61 | $Request = @{ 62 | URI="/projects/$($Project.id)/merge_requests$URLParameters"; 63 | Method='POST'; 64 | } 65 | 66 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.MergeRequest' 67 | } 68 | -------------------------------------------------------------------------------- /PSGitLab/Public/MergeRequests/Remove-GitLabMergeRequest.ps1: -------------------------------------------------------------------------------- 1 | Function Remove-GitLabMergeRequest { 2 | [cmdletbinding(SupportsShouldProcess,ConfirmImpact='High')] 3 | param( 4 | [Alias('project_id')] 5 | [ValidateNotNullOrEmpty()] 6 | [Parameter(Mandatory,ValueFromPipelineByPropertyName)] 7 | [string]$ProjectId, 8 | 9 | [ValidateNotNullOrEmpty()] 10 | [Parameter(Mandatory,ValueFromPipelineByPropertyName)] 11 | [string]$Id 12 | ) 13 | BEGIN {} 14 | 15 | PROCESS { 16 | $Project = $Project = Get-GitlabProject -Id $ProjectId; 17 | 18 | $Request = @{ 19 | URI="/projects/$($Project.id)/merge_requests/$Id"; 20 | Method='Delete'; 21 | } 22 | 23 | $MergeRequest = Get-GitLabMergeRequest -Project $ProjectId -Id $Id 24 | 25 | if ($PSCmdlet.ShouldProcess($MergeRequest.Title, 'Delete Merge Request')) { 26 | $Worked = QueryGitLabAPI -Request $Request -ObjectType 'GitLab.MergeRequest' 27 | } 28 | 29 | } 30 | 31 | END {} 32 | } 33 | -------------------------------------------------------------------------------- /PSGitLab/Public/MergeRequests/Set-GitLabMergeRequest.ps1: -------------------------------------------------------------------------------- 1 | Function Set-GitLabMergeRequest { 2 | [cmdletbinding()] 3 | param( 4 | [Alias('project_id')] 5 | [ValidateNotNullOrEmpty()] 6 | [Parameter(ValueFromPipelineByPropertyName,Mandatory)] 7 | [string]$ProjectId, 8 | 9 | [ValidateNotNullOrEmpty()] 10 | [Parameter(ValueFromPipelineByPropertyName,Mandatory)] 11 | [string[]]$ID, 12 | 13 | [string]$TargetBranch, 14 | 15 | [string]$AssigneeId, 16 | 17 | [string]$Title, 18 | 19 | [string]$Description, 20 | 21 | [ValidateSet("close", "reopen", "merge")] 22 | [string]$StateEvent, 23 | 24 | [string]$Labels, 25 | 26 | [string]$MilestoneId, 27 | 28 | [switch]$Passthru 29 | 30 | ) 31 | 32 | BEGIN {} 33 | 34 | PROCESS { 35 | 36 | foreach ( $MergeRequestID in $ID ) { 37 | $Project = $Project = Get-GitlabProject -Id $ProjectId; 38 | 39 | $MergeRequest = Get-GitLabMergeRequest -ProjectId $ProjectId -Id $MergeRequestID 40 | 41 | Write-Verbose "Project Name: $($Project.Name), Merge Request Name: $($MergeRequest.Name)" 42 | 43 | $GetUrlParameters = @() 44 | 45 | if ($TargetBranch) { 46 | $GetUrlParameters += @{target_branch=$TargetBranch} 47 | } 48 | if ($AssigneeId) { 49 | $GetUrlParameters += @{assignee_id=$AssigneeId} 50 | } 51 | if ($Title) { 52 | $GetUrlParameters += @{title=$Title} 53 | } 54 | if ($Description) { 55 | $GetUrlParameters += @{description=$Description} 56 | } 57 | if ($StateEvent) { 58 | $GetUrlParameters += @{state_event=$StateEvent} 59 | } 60 | if ($Labels) { 61 | $GetUrlParameters += @{labels=$Labels} 62 | } 63 | if ($MilestoneId) { 64 | $GetUrlParameters += @{milestone_id=$MilestoneId} 65 | } 66 | 67 | $URLParameters = GetMethodParameters -GetURLParameters $GetUrlParameters 68 | 69 | $Request = @{ 70 | URI = "/projects/$($Project.ID)/merge_requests/$($MergeRequest.ID)$URLParameters" 71 | Method = 'PUT' 72 | } 73 | 74 | $Results = QueryGitLabAPI -Request $Request -ObjectType 'GitLab.MergeRequest' 75 | 76 | if ( $Passthru.isPresent ) { 77 | $Results 78 | } 79 | } 80 | } 81 | 82 | END {} 83 | 84 | } 85 | -------------------------------------------------------------------------------- /PSGitLab/Public/Milestones/Close-GitLabMilestone.ps1: -------------------------------------------------------------------------------- 1 | Function Close-GitLabMilestone { 2 | [cmdletbinding()] 3 | param( 4 | [Alias('project_id')] 5 | [ValidateNotNullOrEmpty()] 6 | [Parameter(ValueFromPipelineByPropertyName,Mandatory)] 7 | [string]$ProjectId, 8 | 9 | [ValidateNotNullOrEmpty()] 10 | [Parameter(ValueFromPipelineByPropertyName,Mandatory)] 11 | [string[]]$ID, 12 | 13 | [switch]$Passthru 14 | ) 15 | 16 | BEGIN {} 17 | 18 | PROCESS { 19 | 20 | foreach ( $MergeRequestID in $ID ) { 21 | $Results = Set-GitLabMilestone -Project $ProjectId -Id $ID -StateEvent close 22 | 23 | if ( $Passthru.isPresent ) { 24 | $Results 25 | } 26 | } 27 | } 28 | 29 | END {} 30 | 31 | } 32 | -------------------------------------------------------------------------------- /PSGitLab/Public/Milestones/Get-GitLabMilestone.ps1: -------------------------------------------------------------------------------- 1 | Function Get-GitLabMilestone { 2 | [cmdletbinding(DefaultParameterSetName='MergeRequests')] 3 | [OutputType('GitLab.Milestone')] 4 | param ( 5 | [ValidateNotNullOrEmpty()] 6 | [Parameter(ParameterSetName='Single',Mandatory)] 7 | [Parameter(ParameterSetName='MergeRequests',Mandatory)] 8 | [string]$ProjectId, 9 | 10 | [Parameter(ParameterSetName='Single',Mandatory)] 11 | [string]$Id, 12 | 13 | [Parameter(ParameterSetName='MergeRequests')] 14 | # milestone iid 15 | [string]$Iid, 16 | 17 | [Parameter(ParameterSetName='MergeRequests')] 18 | # possible values: active, closed 19 | [string]$State 20 | 21 | ) 22 | $Project = Get-GitlabProject -Id $ProjectId; 23 | 24 | if($PSCmdlet.ParameterSetName -ne 'Single') { 25 | $GetUrlParameters = @() 26 | 27 | if ($Iid) { 28 | $GetUrlParameters += @{iid=$Id} 29 | } 30 | if ($State) { 31 | $GetUrlParameters += @{state=$State} 32 | } 33 | 34 | $URLParameters = GetMethodParameters -GetURLParameters $GetUrlParameters 35 | } 36 | 37 | 38 | $Request = @{ 39 | URI = '' 40 | Method = 'GET' 41 | } 42 | 43 | switch ($PSCmdlet.ParameterSetName) { 44 | MergeRequests { $Request.URI="/projects/$($Project.id)/milestones$URLParameters"; break; } 45 | Single { $Request.URI="/projects/$($Project.id)/milestones/$Id"; break; } 46 | default { Write-Error "Incorrect parameter set."; break; } 47 | } 48 | 49 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Milestone' 50 | } 51 | -------------------------------------------------------------------------------- /PSGitLab/Public/Milestones/New-GitLabMilestone.ps1: -------------------------------------------------------------------------------- 1 | Function New-GitLabMilestone { 2 | [cmdletbinding()] 3 | param( 4 | [ValidateNotNullOrEmpty()] 5 | [Parameter(Mandatory)] 6 | [string]$ProjectId, 7 | 8 | [ValidateNotNullOrEmpty()] 9 | [Parameter(Mandatory)] 10 | [string]$Title, 11 | 12 | [string]$Description, 13 | 14 | [datetime]$DueDate 15 | ) 16 | 17 | $Project = $Project = Get-GitlabProject -Id $ProjectId; 18 | 19 | $GetUrlParameters = @() 20 | $GetUrlParameters += @{title=$Title} 21 | 22 | if ($Description) { 23 | $GetUrlParameters += @{description=$Description} 24 | } 25 | if ($DueDate) { 26 | $GetUrlParameters += @{due_date=($DueDate).ToString("yyyy-MM-dd")} 27 | } 28 | 29 | $URLParameters = GetMethodParameters -GetURLParameters $GetUrlParameters 30 | 31 | $Request = @{ 32 | URI="/projects/$($Project.id)/milestones$URLParameters"; 33 | Method='POST'; 34 | } 35 | 36 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Milestone' 37 | } 38 | -------------------------------------------------------------------------------- /PSGitLab/Public/Milestones/Set-GitLabMilestone.ps1: -------------------------------------------------------------------------------- 1 | Function Set-GitLabMilestone { 2 | [cmdletbinding()] 3 | param( 4 | [Alias('project_id')] 5 | [ValidateNotNullOrEmpty()] 6 | [Parameter(ValueFromPipelineByPropertyName,Mandatory)] 7 | [string]$ProjectId, 8 | 9 | [ValidateNotNullOrEmpty()] 10 | [Parameter(ValueFromPipelineByPropertyName,Mandatory)] 11 | [string[]]$ID, 12 | 13 | [string]$Title, 14 | 15 | [string]$Description, 16 | 17 | [Nullable[datetime]]$DueDate, 18 | 19 | [Alias('state_event')] 20 | [ValidateSet("close", "activate")] 21 | [string]$StateEvent 22 | ) 23 | 24 | BEGIN {} 25 | 26 | PROCESS { 27 | 28 | foreach ( $MilestoneID in $ID ) { 29 | $Project = $Project = Get-GitlabProject -Id $ProjectId; 30 | 31 | $Milestone = Get-GitLabMilestone -ProjectId $ProjectId -Id $MilestoneID 32 | 33 | Write-Verbose "Project Name: $($Project.Name), Milestone Name: $($Milestone.Name)" 34 | 35 | $GetUrlParameters = @() 36 | 37 | if ($Title) { 38 | $GetUrlParameters += @{title=$Title} 39 | } 40 | if ($Description) { 41 | $GetUrlParameters += @{description=$Description} 42 | } 43 | if ($DueDate) { 44 | $GetUrlParameters += @{due_date=$DueDate.ToString("yyyy-MM-dd")} 45 | } 46 | if ($StateEvent) { 47 | $GetUrlParameters += @{state_event=$StateEvent} 48 | } 49 | 50 | $URLParameters = GetMethodParameters -GetURLParameters $GetUrlParameters 51 | 52 | $Request = @{ 53 | URI = "/projects/$($Project.ID)/milestones/$($Milestone.ID)$URLParameters" 54 | Method = 'PUT' 55 | } 56 | 57 | $Results = QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Milestone' 58 | 59 | if ( $Passthru.isPresent ) { 60 | $Results 61 | } 62 | } 63 | } 64 | 65 | END {} 66 | 67 | } 68 | -------------------------------------------------------------------------------- /PSGitLab/Public/Namespaces/Get-GitLabNamespace.ps1: -------------------------------------------------------------------------------- 1 | Function Get-GitLabNamespace { 2 | [cmdletbinding()] 3 | [OutputType('GitLab.Namespace')] 4 | param ( 5 | [string]$search 6 | ) 7 | $GetUrlParameters = @() 8 | 9 | if ($search -ne $null) { 10 | $GetUrlParameters += @{search=$search} 11 | } 12 | $GetUrlParameters += @{per_page=100} 13 | $URLParameters = GetMethodParameters -GetURLParameters $GetUrlParameters 14 | #$Request.URI = "$($Request.URI)" + "$URLParameters" 15 | $Request = @{ 16 | URI="/namespaces$URLParameters"; 17 | Method='Get'; 18 | } 19 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Namespace' 20 | } 21 | -------------------------------------------------------------------------------- /PSGitLab/Public/Projects/Get-GitLabPipeline.ps1: -------------------------------------------------------------------------------- 1 | Function Get-GitLabPipeline { 2 | [cmdletbinding(DefaultParameterSetName='Pipelines')] 3 | [OutputType("GitLab.Project.Pipeline")] 4 | param( 5 | 6 | [Parameter(Mandatory=$true)] 7 | 8 | [int]$ProjectID, 9 | 10 | [Parameter(Mandatory=$true,ParameterSetName='Single')] 11 | [int]$Id, 12 | 13 | [Parameter(Mandatory=$false, ParameterSetName='ByBranch')] 14 | [Parameter(Mandatory=$false, ParameterSetName='ByTag')] 15 | [Parameter(Mandatory=$false,ParameterSetName='Pipelines')] 16 | [ValidateSet("running","pending","finished","branches","tags","all")] 17 | $Scope = 'all', 18 | 19 | [Parameter(Mandatory=$false, ParameterSetName='ByBranch')] 20 | [Parameter(Mandatory=$false, ParameterSetName='ByTag')] 21 | [Parameter(Mandatory=$false, ParameterSetName='Pipelines')] 22 | [ValidateSet("running","pending","success","failed","canceled","skipped","all")] 23 | $Status = 'all', 24 | 25 | [Parameter(Mandatory=$true, ParameterSetName='ByBranch')] 26 | [String]$Branch, 27 | 28 | [Parameter(Mandatory=$true, ParameterSetName='ByTag')] 29 | [String]$Tag, 30 | 31 | [Parameter(Mandatory=$false, ParameterSetName='ByBranch')] 32 | [Parameter(Mandatory=$false, ParameterSetName='ByTag')] 33 | [Parameter(Mandatory=$false,ParameterSetName='Pipelines')] 34 | [ValidateSet("id","status","ref","user_id")] 35 | $Order_by = "id", 36 | 37 | [Parameter(Mandatory=$false, ParameterSetName='ByBranch')] 38 | [Parameter(Mandatory=$false, ParameterSetName='ByTag')] 39 | [Parameter(Mandatory=$false,ParameterSetName='Pipelines')] 40 | [ValidateSet('asc','desc')] 41 | $Sort = 'desc' 42 | 43 | ) 44 | 45 | $Request = @{ 46 | URI = '' 47 | Method = 'GET' 48 | } 49 | 50 | $Project = Get-GitlabProject -Id $ProjectId 51 | 52 | Write-Verbose -Message "Returning a pipeline(s) for the project $($Project.Name) and id $($Project.Id)" 53 | 54 | if ($PSCmdlet.ParameterSetName -ne 'Single') { 55 | 56 | $GetUrlParameters = @() 57 | 58 | if ($PSCmdlet.ParameterSetName -eq 'ByBranch') { 59 | $GetUrlParameters += @{ref=$Branch} 60 | } 61 | elseif ($PSCmdlet.ParameterSetName -eq 'ByTag') { 62 | $GetUrlParameters += @{ref=$Tag} 63 | } 64 | 65 | if ($Scope -ne 'all') { 66 | $GetUrlParameters += @{scope='all'} 67 | } 68 | 69 | if ($Status -ne 'all') { 70 | $GetUrlParameters += @{status=$Status} 71 | } 72 | 73 | $GetUrlParameters += @{order_by=$order_by} 74 | $GetUrlParameters += @{sort=$sort} 75 | $GetUrlParameters += @{per_page=100} 76 | $URLParameters = GetMethodParameters -GetURLParameters $GetUrlParameters 77 | 78 | } 79 | 80 | Write-Verbose -Message "Parameter Set Name: $($PSCmdlet.ParameterSetName)" 81 | 82 | switch ($PSCmdlet.ParameterSetName) { 83 | Pipelines { $Request.URI="/projects/$($Project.id)/pipelines$URLParameters"; break; } 84 | Single { $Request.URI= "/projects/$($Project.id)/pipelines/$($Id)"; break; } 85 | default { Write-Error "Incorrect parameter set."; break; } 86 | } 87 | 88 | Write-Verbose -Message "A prepared API request: $($($Request.URI).ToString())" 89 | 90 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Project.Pipeline' -Verbose 91 | 92 | } 93 | -------------------------------------------------------------------------------- /PSGitLab/Public/Projects/Get-GitLabProjectArchive.ps1: -------------------------------------------------------------------------------- 1 | Function Get-GitLabProjectArchive 2 | { 3 | [OutputType('String')] 4 | param( 5 | [parameter(mandatory,HelpMessage = 'Project ID')][int]$ProjectID, 6 | [string]$CommitID = $null, 7 | [string]$OutFile = "$PWD\test.zip" 8 | ) 9 | 10 | $Commits = Get-GitLabProjectCommit -id $ProjectID 11 | IF (-not($CommitID)) 12 | { 13 | $CommitID = $Commits[0].id #most recent commit id 14 | } 15 | ElseIF ($Commits | Where-Object -FilterScript { 16 | $_.id -eq $CommitID 17 | }) 18 | { 19 | Write-Verbose -Message ('Commit id OK') 20 | } 21 | Else 22 | { 23 | Throw 'Commit ID bad' 24 | } 25 | $ProjectName = (Get-GitLabProject | Where-Object -FilterScript { 26 | ($_.id -eq $ProjectID) 27 | }).Name 28 | $RequestURI = ('/projects/{0}/repository/archive.zip?sha={1}' -f $ProjectID, $CommitID) 29 | DownloadFromGitLabAPI -RequestURI $RequestURI -OutFile $OutFile 30 | return ('Project ID:{0} Archive saved to {1}' -f $ProjectID, $OutFile) 31 | } 32 | -------------------------------------------------------------------------------- /PSGitLab/Public/Projects/Get-GitLabProjectCommit.ps1: -------------------------------------------------------------------------------- 1 | Function Get-GitLabProjectCommit 2 | { 3 | [OutputType('GitLab.Project.Commit')] 4 | [cmdletbinding()] 5 | param( 6 | [ValidateNotNull()] 7 | [ValidateNotNullOrEmpty()] 8 | [Parameter(ParameterSetName = 'Id')] 9 | [string]$Id, 10 | 11 | [ValidateNotNull()] 12 | [ValidateNotNullOrEmpty()] 13 | #[Parameter(ParameterSetName='Namespace')] 14 | [string]$Namespace, 15 | 16 | [Alias('Tag')] 17 | [string] 18 | $Branch, 19 | 20 | [datetime] 21 | $After, 22 | 23 | [datetime] 24 | $Before 25 | 26 | ) 27 | 28 | $Project = $null 29 | switch ($PSCmdlet.ParameterSetName) { 30 | 'Id' 31 | { 32 | $Project = Get-GitLabProject -Id $Id 33 | } 34 | 'Namespace' 35 | { 36 | $Project = Get-GitLabProject -Namespace $Namespace 37 | } 38 | } 39 | 40 | $Body = @{} 41 | 42 | switch ($PsBoundParameters.Keys) { 43 | 'Branch' 44 | { 45 | $Body.Add('ref_name',$Branch) 46 | } 47 | 'After' 48 | { 49 | $Body.Add('since',(Get-Date $After -Format s)) 50 | } 51 | 'Before' 52 | { 53 | $Body.Add('until',(Get-Date $Before -Format s)) 54 | } 55 | } 56 | 57 | $Request = @{ 58 | URI = "/projects/$($Project.id)/repository/commits" 59 | Method = 'GET' 60 | Body = $Body 61 | } 62 | 63 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Project.Commit' 64 | } 65 | -------------------------------------------------------------------------------- /PSGitLab/Public/Projects/Get-GitLabProjectEvent.ps1: -------------------------------------------------------------------------------- 1 | Function Get-GitLabProjectEvent { 2 | [cmdletbinding()] 3 | [OutputType('GitLab.Project.Event')] 4 | param( 5 | [ValidateNotNull()] 6 | [ValidateNotNullOrEmpty()] 7 | [Parameter(ParameterSetName='Id')] 8 | [string]$Id, 9 | 10 | [ValidateNotNull()] 11 | [ValidateNotNullOrEmpty()] 12 | [Parameter(ParameterSetName='Namespace')] 13 | [string]$Namespace 14 | ) 15 | 16 | $queryID = $null 17 | switch ($PSCmdlet.ParameterSetName) { 18 | 'Id' { $queryID = $id } 19 | 'Namespace' { $queryID = $Namespace -replace '/','%2F' -replace ' ','' } 20 | } 21 | 22 | $Request = @{ 23 | URI="/projects/$queryID/events"; 24 | Method='Get'; 25 | } 26 | 27 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Project.Event' 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /PSGitLab/Public/Projects/Get-GitLabProjectServiceMSTeams.ps1: -------------------------------------------------------------------------------- 1 | Function Get-GitLabProjectServiceMSTeams 2 | { 3 | [OutputType('GitLab.Project.Service.MSTeams')] 4 | [cmdletbinding()] 5 | param( 6 | [ValidateNotNull()] 7 | [ValidateNotNullOrEmpty()] 8 | [Parameter(ParameterSetName = 'Id')] 9 | [string]$Id, 10 | 11 | [ValidateNotNull()] 12 | [ValidateNotNullOrEmpty()] 13 | #[Parameter(ParameterSetName='Namespace')] 14 | [string]$Namespace 15 | ) 16 | 17 | $Project = $null 18 | switch ($PSCmdlet.ParameterSetName) { 19 | 'Id' 20 | { 21 | $Project = Get-GitLabProject -Id $Id 22 | } 23 | 'Namespace' 24 | { 25 | $Project = Get-GitLabProject -Namespace $Namespace 26 | } 27 | } 28 | 29 | $Request = @{ 30 | URI = "/projects/$($Project.id)/services/microsoft-teams" 31 | Method = 'GET' 32 | } 33 | 34 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Project.Service.MSTeams' 35 | } 36 | -------------------------------------------------------------------------------- /PSGitLab/Public/Projects/Get-GitLabProjectServiceSlack.ps1: -------------------------------------------------------------------------------- 1 | Function Get-GitLabProjectServiceSlack 2 | { 3 | [OutputType('GitLab.Project.Service.Slack')] 4 | [cmdletbinding()] 5 | param( 6 | [ValidateNotNull()] 7 | [ValidateNotNullOrEmpty()] 8 | [Parameter(ParameterSetName = 'Id')] 9 | [string]$Id, 10 | 11 | [ValidateNotNull()] 12 | [ValidateNotNullOrEmpty()] 13 | #[Parameter(ParameterSetName='Namespace')] 14 | [string]$Namespace 15 | ) 16 | 17 | $Project = $null 18 | switch ($PSCmdlet.ParameterSetName) { 19 | 'Id' 20 | { 21 | $Project = Get-GitLabProject -Id $Id 22 | } 23 | 'Namespace' 24 | { 25 | $Project = Get-GitLabProject -Namespace $Namespace 26 | } 27 | } 28 | 29 | $Request = @{ 30 | URI = "/projects/$($Project.id)/services/slack" 31 | Method = 'GET' 32 | } 33 | 34 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Project.Service.Slack' 35 | } 36 | -------------------------------------------------------------------------------- /PSGitLab/Public/Projects/Get-GitLabProjectSubmodule.ps1: -------------------------------------------------------------------------------- 1 | function Get-GitlabProjectSubmodule 2 | { 3 | 4 | [OutputType('GitLab.Project.Submodule.Information')] 5 | [cmdletbinding()] 6 | param( 7 | [parameter(mandatory,HelpMessage='Project ID')][int]$ProjectID, 8 | [string]$CommitID 9 | ) 10 | $repoTree = Get-GitlabProjectRepositoryTree -ProjectID $ProjectID 11 | If (-not($repotree | Where-Object -FilterScript { 12 | ($_.Type -eq 'blob') -and ($_.name -eq '.gitmodules') 13 | })) { 14 | Throw ('.gitmodules file missing from Project {0}' -f $ProjectID) 15 | } 16 | $Projects = Get-GitLabProject 17 | $repoTree = $repoTree | Where-Object -FilterScript { 18 | $_.Type -eq 'commit' 19 | } 20 | $Request = @{ 21 | URI = ('/projects/{0}/repository/files/.gitmodules?ref={1}' -f $repoTree[0].ProjectID, $repoTree[0].CommitID) 22 | Method = 'GET' 23 | } 24 | $GitsubmoduleFile = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String((QueryGitLabAPI -Request $Request -ObjectType 'File').content)) 25 | $Gitsubmodules = $GitsubmoduleFile.Split('[]') -ne '' | ForEach-Object -Begin { 26 | $i = 0 27 | } -Process { 28 | if ($i++ % 2) 29 | { 30 | [PSCustomObject](ConvertFrom-StringData -StringData $_) 31 | } 32 | } 33 | $Object = @() 34 | Foreach ($commit in $repoTree) 35 | { 36 | $SubmoduleURL = ($Gitsubmodules | Where-Object -FilterScript { 37 | $_.path -eq $commit.Path 38 | }).url 39 | $SubmoduleProjectName = $SubmoduleURL.Split('/')[-1].Replace('.git','') 40 | $SubModuleNamespace = $SubmoduleURL.Split('/')[-2] 41 | $SubmoduleProjectID = ($Projects | Where-Object -FilterScript { 42 | $_.name -eq $SubmoduleProjectName 43 | }).Id 44 | $hash = [pscustomobject]@{ 45 | ParentProjectID = $commit.ProjectID 46 | ParentProjectCommitID = $commit.CommitID 47 | SubModuleNamespace = $SubModuleNamespace 48 | SubmoduleProjectID = $SubmoduleProjectID 49 | SubmoduleProjectName = $SubmoduleProjectName 50 | SubmodulePath = $commit.Path 51 | SubmoduleFoldername = $commit.Name 52 | SubmoduleURL = $SubmoduleURL 53 | SubmoduleProjectCommitID = $commit.ID 54 | } 55 | $Object += $hash 56 | } 57 | 58 | $Object 59 | } 60 | -------------------------------------------------------------------------------- /PSGitLab/Public/Projects/Get-GitLabProjectTag.ps1: -------------------------------------------------------------------------------- 1 | Function Get-GitLabProjectTag 2 | { 3 | [OutputType('GitLab.Project.Tag')] 4 | [cmdletbinding()] 5 | param( 6 | [ValidateNotNull()] 7 | [ValidateNotNullOrEmpty()] 8 | [Parameter(ParameterSetName = 'Id')] 9 | [string]$Id, 10 | 11 | [ValidateNotNull()] 12 | [ValidateNotNullOrEmpty()] 13 | #[Parameter(ParameterSetName='Namespace')] 14 | [string]$Namespace 15 | ) 16 | 17 | $Project = $null 18 | switch ($PSCmdlet.ParameterSetName) { 19 | 'Id' 20 | { 21 | $Project = Get-GitLabProject -Id $Id 22 | } 23 | 'Namespace' 24 | { 25 | $Project = Get-GitLabProject -Namespace $Namespace 26 | } 27 | } 28 | 29 | $Request = @{ 30 | URI = "/projects/$($Project.id)/repository/tags" 31 | Method = 'GET' 32 | } 33 | 34 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Project.Tag' 35 | } 36 | -------------------------------------------------------------------------------- /PSGitLab/Public/Projects/Get-GitLabProjectWebhook.ps1: -------------------------------------------------------------------------------- 1 | Function Get-GitLabProjectWebhook 2 | { 3 | 4 | [OutputType('GitLab.Project.Webhook')] 5 | [cmdletbinding()] 6 | param( 7 | [ValidateNotNull()] 8 | [ValidateNotNullOrEmpty()] 9 | [Parameter(ParameterSetName = 'Id')] 10 | [string]$Id, 11 | 12 | [ValidateNotNull()] 13 | [ValidateNotNullOrEmpty()] 14 | #[Parameter(ParameterSetName='Namespace')] 15 | [string]$Namespace 16 | ) 17 | 18 | $Project = $null 19 | switch ($PSCmdlet.ParameterSetName) { 20 | 'Id' 21 | { 22 | $Project = Get-GitLabProject -Id $Id 23 | } 24 | 'Namespace' 25 | { 26 | $Project = Get-GitLabProject -Namespace $Namespace 27 | } 28 | } 29 | 30 | $Request = @{ 31 | URI = "/projects/$($Project.id)/hooks" 32 | Method = 'GET' 33 | } 34 | 35 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Project.Webhook' 36 | } 37 | -------------------------------------------------------------------------------- /PSGitLab/Public/Projects/Get-GitlabProjectRepositoryTree.ps1: -------------------------------------------------------------------------------- 1 | function Get-GitlabProjectRepositoryTree 2 | { 3 | 4 | [OutputType('GitLab.Repository.Tree')] 5 | [cmdletbinding()] 6 | param( 7 | [parameter(mandatory,HelpMessage='Project ID')][int]$ProjectID, 8 | [string]$CommitID 9 | ) 10 | 11 | 12 | $Commits = Get-GitLabProjectCommit -Id $ProjectID 13 | IF (-not($CommitID)) 14 | { 15 | $CommitID = $Commits[0].id #most recent commit id 16 | } 17 | ElseIF ($Commits | Where-Object -FilterScript { 18 | $_.id -eq $CommitID 19 | }) 20 | { 21 | Write-Verbose -Message ('Commit id OK') 22 | } 23 | Else 24 | { 25 | Throw 'Commit ID bad' 26 | } 27 | 28 | $repoTree = (QueryGitLabAPI -Request @{ 29 | URI = ('/projects/{0}/repository/tree?ref_name={1}&recursive=true' -f $ProjectID, $CommitID) 30 | Method = 'GET' 31 | } -ObjectType 'GitLab.Repository.Tree') 32 | $repoTree | Add-Member -MemberType NoteProperty -Name 'ProjectID' -Value $ProjectID 33 | $repoTree | Add-Member -MemberType NoteProperty -Name 'CommitID' -Value $CommitID 34 | return $repoTree 35 | } 36 | -------------------------------------------------------------------------------- /PSGitLab/Public/Projects/New-GitLabFork.ps1: -------------------------------------------------------------------------------- 1 | Function New-GitLabFork { 2 | [cmdletbinding()] 3 | param( 4 | [ValidateNotNull()] 5 | [ValidateNotNullOrEmpty()] 6 | [Parameter(ParameterSetName='Id')] 7 | [string]$Id, 8 | 9 | [ValidateNotNull()] 10 | [ValidateNotNullOrEmpty()] 11 | #[Parameter(ParameterSetName='Namespace')] 12 | [string]$Namespace 13 | ) 14 | 15 | $Project = $null 16 | switch ($PSCmdlet.ParameterSetName) { 17 | 'Id' { $Project = Get-GitLabProject -Id $Id } 18 | 'Namespace' { $Project = Get-GitLabProject -Namespace $Namespace } 19 | } 20 | 21 | $Request = @{ 22 | URI="/projects/fork/$($Project.id)"; 23 | Method='POST'; 24 | } 25 | 26 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Project' 27 | } 28 | -------------------------------------------------------------------------------- /PSGitLab/Public/Projects/New-GitLabProject.ps1: -------------------------------------------------------------------------------- 1 | Function New-GitLabProject { 2 | [cmdletbinding()] 3 | param( 4 | [ValidateNotNull()] 5 | [ValidateNotNullOrEmpty()] 6 | [Parameter(Mandatory=$true)] 7 | [Alias('Path')] 8 | [string]$name, 9 | [Parameter(Mandatory=$true)] 10 | [string]$namespace, 11 | [string]$description, 12 | [switch]$issues_enabled, 13 | [switch]$merge_requests_enabled, 14 | [switch]$builds_enabled, 15 | [switch]$wiki_enabled, 16 | [Switch]$snippets_enabled, 17 | [Switch]$container_registry_enabled, 18 | [Switch]$public, 19 | [ValidateSet("Private", "Internal", "Public")] 20 | [String]$visibility_level 21 | ) 22 | 23 | $Body = @{ 24 | name = $Name 25 | } 26 | $PSBoundParameters.Remove('Name') | Out-Null 27 | 28 | try { 29 | if ($PSBoundParameters.ContainsKey('Namespace')) { 30 | $nSpace = Get-GitLabNamespace | Where-Object {$_.path -eq "$Namespace"} 31 | if ($nSpace.id.Count -eq 1) { 32 | $Body.Add('namespace_id', $nSpace.id) 33 | $PSBoundParameters.Remove('Namespace') | Out-Null 34 | } else { 35 | throw "Error: No Namespace found" 36 | } 37 | 38 | foreach($p in $PSBoundParameters.GetEnumerator()) { 39 | if ($p.Key -eq 'visibility_level') { 40 | $vLevel = switch ($p.Value) { 41 | 'Private' {0} 42 | 'Internal' {10} 43 | 'Public' {20} 44 | } 45 | $Body.Add($p.Key, $vLevel) 46 | } else { 47 | $Body.Add($p.Key, $p.Value) 48 | } 49 | } 50 | 51 | $Request = @{ 52 | URI='/projects'; 53 | Method='POST'; 54 | Body=$Body; 55 | } 56 | 57 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Project' 58 | } 59 | } 60 | catch { 61 | Write-Error $_ 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /PSGitLab/Public/Projects/New-GitLabProjectWebhook.ps1: -------------------------------------------------------------------------------- 1 | Function New-GitLabProjectWebhook 2 | { 3 | 4 | 5 | [OutputType('GitLab.Project.Webhook')] 6 | [cmdletbinding()] 7 | param( 8 | [ValidateNotNull()] 9 | [ValidateNotNullOrEmpty()] 10 | [Parameter(ParameterSetName = 'Id')] 11 | [string]$Id, 12 | 13 | [ValidateNotNull()] 14 | [ValidateNotNullOrEmpty()] 15 | #[Parameter(ParameterSetName='Namespace')] 16 | [string]$Namespace, 17 | [parameter(mandatory,HelpMessage = 'WebHook URL')][string]$URL, 18 | [switch]$push_events, 19 | [switch]$issues_events, 20 | [switch]$merge_requests_events, 21 | [switch]$tag_push_events, 22 | [switch]$note_events, 23 | [switch]$pipeline_events, 24 | [switch]$wiki_events, 25 | [switch]$enable_ssl_verification, 26 | [string]$Token 27 | 28 | ) 29 | $Project = $null 30 | switch ($PSCmdlet.ParameterSetName) { 31 | 'Id' 32 | { 33 | $Project = Get-GitLabProject -Id $Id 34 | $null = $PSBoundParameters.Remove('Id') 35 | } 36 | 'Namespace' 37 | { 38 | $Project = Get-GitLabProject -Namespace $Namespace 39 | $null = $PSBoundParameters.Remove('Namespace') 40 | } 41 | } 42 | $Body = @{ 43 | id = $Project.id 44 | url = $URL 45 | } 46 | If ($PSBoundParameters.ContainsKey('verbose')) 47 | { 48 | $null = $PSBoundParameters.Remove('verbose') 49 | } 50 | $PSBoundParameters.Remove('URL') 51 | If (-not($PSBoundParameters.ContainsKey('enable_ssl_verification'))) 52 | { 53 | $PSBoundParameters.Add('enable_ssl_verification',$False) 54 | } 55 | try 56 | { 57 | foreach($p in $PSBoundParameters.GetEnumerator()) 58 | { 59 | $Body.Add($p.Key, $($p.Value)) 60 | } 61 | 62 | $Request = @{ 63 | URI = "/projects/$($Project.id)/hooks" 64 | Method = 'POST' 65 | Body = $Body 66 | } 67 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Project.Webhook' 68 | } 69 | catch 70 | { 71 | Write-Error -Message $_ 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /PSGitLab/Public/Projects/Remove-GitLabProject.ps1: -------------------------------------------------------------------------------- 1 | Function Remove-GitLabProject { 2 | [cmdletbinding(SupportsShouldProcess=$True,ConfirmImpact='High')] 3 | param( 4 | [ValidateNotNull()] 5 | [ValidateNotNullOrEmpty()] 6 | [Parameter(Mandatory=$true, 7 | ValueFromPipelineByPropertyName=$true)] 8 | [string]$Id 9 | ) 10 | BEGIN {} 11 | 12 | PROCESS { 13 | 14 | $Request = @{ 15 | URI="/projects/$ID"; 16 | Method='Delete'; 17 | } 18 | 19 | $Project = Get-GitLabProject -Id $Id 20 | 21 | if ($PSCmdlet.ShouldProcess($Project.Name, 'Delete Project')) { 22 | $Worked = QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Project' 23 | } 24 | 25 | } 26 | 27 | END {} 28 | 29 | 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /PSGitLab/Public/Projects/Remove-GitLabProjectServiceMSTeams.ps1: -------------------------------------------------------------------------------- 1 | Function Remove-GitLabProjectServiceMSTeams 2 | { 3 | [OutputType('GitLab.Project.Service.MSTeams')] 4 | [cmdletbinding()] 5 | param( 6 | [ValidateNotNull()] 7 | [ValidateNotNullOrEmpty()] 8 | [Parameter(ParameterSetName = 'Id')] 9 | [string]$Id, 10 | 11 | [ValidateNotNull()] 12 | [ValidateNotNullOrEmpty()] 13 | #[Parameter(ParameterSetName='Namespace')] 14 | [string]$Namespace 15 | 16 | ) 17 | 18 | $Project = $null 19 | switch ($PSCmdlet.ParameterSetName) { 20 | 'Id' 21 | { 22 | $Project = Get-GitLabProject -Id $Id 23 | $null = $PSBoundParameters.Remove('Id') 24 | } 25 | 'Namespace' 26 | { 27 | $Project = Get-GitLabProject -Namespace $Namespace 28 | $null = $PSBoundParameters.Remove('Namespace') 29 | } 30 | } 31 | If ($PSBoundParameters.ContainsKey('verbose')) 32 | { 33 | $null = $PSBoundParameters.Remove('verbose') 34 | } 35 | 36 | try 37 | { 38 | $Request = @{ 39 | URI = "/projects/$($Project.id)/services/microsoft-teams" 40 | Method = 'DELETE' 41 | } 42 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Project.Services.MSTeams' 43 | } 44 | catch 45 | { 46 | Write-Error -Message $_ 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /PSGitLab/Public/Projects/Remove-GitLabProjectServiceSlack.ps1: -------------------------------------------------------------------------------- 1 | Function Remove-GitLabProjectServiceSlack 2 | { 3 | [OutputType('GitLab.Project.Service.Slack')] 4 | [cmdletbinding()] 5 | param( 6 | [ValidateNotNull()] 7 | [ValidateNotNullOrEmpty()] 8 | [Parameter(ParameterSetName = 'Id')] 9 | [string]$Id, 10 | 11 | [ValidateNotNull()] 12 | [ValidateNotNullOrEmpty()] 13 | #[Parameter(ParameterSetName='Namespace')] 14 | [string]$Namespace 15 | 16 | ) 17 | 18 | $Project = $null 19 | switch ($PSCmdlet.ParameterSetName) { 20 | 'Id' 21 | { 22 | $Project = Get-GitLabProject -Id $Id 23 | $null = $PSBoundParameters.Remove('Id') 24 | } 25 | 'Namespace' 26 | { 27 | $Project = Get-GitLabProject -Namespace $Namespace 28 | $null = $PSBoundParameters.Remove('Namespace') 29 | } 30 | } 31 | If ($PSBoundParameters.ContainsKey('verbose')) 32 | { 33 | $null = $PSBoundParameters.Remove('verbose') 34 | } 35 | 36 | try 37 | { 38 | $Request = @{ 39 | URI = "/projects/$($Project.id)/services/slack" 40 | Method = 'DELETE' 41 | } 42 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Project.Services.Slack' 43 | } 44 | catch 45 | { 46 | Write-Error -Message $_ 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /PSGitLab/Public/Projects/Remove-GitLabProjectWebhook.ps1: -------------------------------------------------------------------------------- 1 | Function Remove-GitLabProjectWebhook 2 | { 3 | [OutputType('GitLab.Project.Webhook')] 4 | [cmdletbinding()] 5 | param( 6 | [ValidateNotNull()] 7 | [ValidateNotNullOrEmpty()] 8 | [Parameter(ParameterSetName = 'Id')] 9 | [string]$Id, 10 | 11 | [ValidateNotNull()] 12 | [ValidateNotNullOrEmpty()] 13 | #[Parameter(ParameterSetName='Namespace')] 14 | [string]$Namespace, 15 | [parameter(mandatory,HelpMessage = 'Webhook id')][string]$hook_id 16 | 17 | ) 18 | 19 | $Project = $null 20 | switch ($PSCmdlet.ParameterSetName) { 21 | 'Id' 22 | { 23 | $Project = Get-GitLabProject -Id $Id 24 | $null = $PSBoundParameters.Remove('Id') 25 | } 26 | 'Namespace' 27 | { 28 | $Project = Get-GitLabProject -Namespace $Namespace 29 | $null = $PSBoundParameters.Remove('Namespace') 30 | } 31 | } 32 | If ($PSBoundParameters.ContainsKey('verbose')) 33 | { 34 | $null = $PSBoundParameters.Remove('verbose') 35 | } 36 | $Body = @{ 37 | id = $Project.id 38 | url = $URL 39 | hook_id = $hook_id 40 | } 41 | try 42 | { 43 | $Request = @{ 44 | URI = "/projects/$($Project.id)/hooks/$hook_id" 45 | Method = 'DELETE' 46 | Body = $Body 47 | } 48 | $Body 49 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Project.Webhook' 50 | } 51 | catch 52 | { 53 | Write-Error -Message $_ 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /PSGitLab/Public/Projects/Restart-GitLabPipeline.ps1: -------------------------------------------------------------------------------- 1 | Function Restart-GitLabPipeline { 2 | [OutputType("GitLab.Project.Pipeline")] 3 | param( 4 | 5 | [Parameter(Mandatory=$true)] 6 | [int]$ProjectID, 7 | 8 | [Parameter(Mandatory=$true)] 9 | [int]$Id 10 | 11 | ) 12 | 13 | $Request = @{ 14 | URI = '' 15 | Method = 'GET' 16 | } 17 | 18 | $Project = Get-GitlabProject -Id $ProjectId 19 | 20 | $Pipeline = Get-GitLabPipeline -Id $ProjectID -Id $Id 21 | 22 | if (@('running', 'pending') -contains $Pipeline.status ) { 23 | 24 | Write-Warning -Message "The status for the pipeline $Id is $PipelineId so it can't be canceled." 25 | 26 | } 27 | else { 28 | 29 | $Request.URI= "/projects/$($Project.id)/pipelines/$Id/retry" 30 | 31 | Write-Verbose -Message "A prepared API request: $($($Request.URI).ToString())" 32 | 33 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Project.Pipeline' 34 | 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /PSGitLab/Public/Projects/Set-GitLabProject.ps1: -------------------------------------------------------------------------------- 1 | Function Set-GitLabProject 2 | { 3 | [cmdletbinding()] 4 | param( 5 | 6 | [ValidateNotNullOrEmpty()] 7 | [Parameter( 8 | Mandatory=$true, 9 | ParameterSetName='ID', 10 | ValueFromPipelineByPropertyName=$true 11 | )] 12 | [string[]]$ID, 13 | 14 | [string]$Name = $null, 15 | 16 | [string]$Path = $null, 17 | 18 | [string]$Description = $null, 19 | 20 | #$default_branch, 21 | 22 | #[Alias('issues_enabled')] 23 | #[switch]$IssuesEnabled = $false, 24 | #$merge_requests_enabled, 25 | #$wiki_enabled, 26 | #$snippets_enabled, 27 | #$public, 28 | 29 | [Alias('visibility_level')] 30 | [ValidateSet("Public", "Internal", "Private")] 31 | $VisabilityLevel = $null, 32 | 33 | [switch]$Passthru 34 | 35 | ) 36 | 37 | BEGIN {} 38 | 39 | PROCESS { 40 | 41 | foreach ( $ProjID in $ID ) { 42 | $Project = Get-GitLabProject -Id $ProjID 43 | 44 | Write-Verbose "Project Name: $($Project.Name)" 45 | 46 | $Body = @{} 47 | 48 | if ($Name -ne $null) { $Body.Add('name',$Name) } 49 | if ($Path -ne $null) { $Body.Add('path',$Path) } 50 | if ($Description -ne $null) { $Body.Add('description',$Description) } 51 | if ($VisabilityLevel -ne $null ) { $Body.Add('visibility_level', (GetVisibilityLevel $VisabilityLevel) )} 52 | 53 | Write-Verbose ( $PSBoundParameters | ConvertTo-Json ) 54 | 55 | Write-Verbose "Body: $($Body | ConvertTo-Json )" 56 | 57 | $Request = @{ 58 | URI = "/projects/$($Project.ID)" 59 | Method = 'PUT' 60 | Body = $Body 61 | ContentType = 'application/x-www-form-urlencoded' 62 | } 63 | 64 | $Results = QueryGitLabAPI -Request $Request -ObjectType 'GitLab.User' 65 | 66 | if ( $Passthru.isPresent ) { 67 | $Results 68 | } 69 | } 70 | } 71 | 72 | END {} 73 | 74 | } 75 | -------------------------------------------------------------------------------- /PSGitLab/Public/Projects/Set-GitLabProjectServiceMSTeams.ps1: -------------------------------------------------------------------------------- 1 | Function Set-GitLabProjectServiceMSTeams 2 | { 3 | [OutputType('GitLab.Project.Service.MSTeams')] 4 | [cmdletbinding()] 5 | param( 6 | [ValidateNotNull()] 7 | [ValidateNotNullOrEmpty()] 8 | [Parameter(ParameterSetName = 'Id')] 9 | [string]$Id, 10 | 11 | [ValidateNotNull()] 12 | [ValidateNotNullOrEmpty()] 13 | #[Parameter(ParameterSetName='Namespace')] 14 | [string]$Namespace, 15 | [parameter(mandatory,HelpMessage='MSTeams Webhook')][string]$webhook 16 | ) 17 | 18 | $Project = $null 19 | switch ($PSCmdlet.ParameterSetName) { 20 | 'Id' 21 | { 22 | $Project = Get-GitLabProject -Id $Id 23 | $null = $PSBoundParameters.Remove('Id') 24 | } 25 | 'Namespace' 26 | { 27 | $Project = Get-GitLabProject -Namespace $Namespace 28 | $null = $PSBoundParameters.Remove('Namespace') 29 | } 30 | } 31 | If ($PSBoundParameters.ContainsKey('verbose')) 32 | { 33 | $null = $PSBoundParameters.Remove('verbose') 34 | } 35 | $Body = @{ 36 | webhook = $webhook 37 | } 38 | $null = $PSBoundParameters.Remove('webhook') 39 | try 40 | { 41 | $Request = @{ 42 | URI = "/projects/$($Project.id)/services/microsoft-teams" 43 | Method = 'PUT' 44 | Body = $Body 45 | ContentType = 'application/x-www-form-urlencoded' 46 | } 47 | $Body 48 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Project.Service.MSTeams' 49 | } 50 | catch 51 | { 52 | Write-Error -Message $_ 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /PSGitLab/Public/Projects/Set-GitLabProjectServiceSlack.ps1: -------------------------------------------------------------------------------- 1 | Function Set-GitLabProjectServiceSlack 2 | { 3 | [OutputType('GitLab.Project.Service.Slack')] 4 | [cmdletbinding()] 5 | param( 6 | [ValidateNotNull()] 7 | [ValidateNotNullOrEmpty()] 8 | [Parameter(ParameterSetName = 'Id')] 9 | [string]$Id, 10 | 11 | [ValidateNotNull()] 12 | [ValidateNotNullOrEmpty()] 13 | #[Parameter(ParameterSetName='Namespace')] 14 | [string]$Namespace, 15 | [parameter(mandatory,HelpMessage='Slack Webhook')][string]$webhook 16 | ) 17 | 18 | $Project = $null 19 | switch ($PSCmdlet.ParameterSetName) { 20 | 'Id' 21 | { 22 | $Project = Get-GitLabProject -Id $Id 23 | $null = $PSBoundParameters.Remove('Id') 24 | } 25 | 'Namespace' 26 | { 27 | $Project = Get-GitLabProject -Namespace $Namespace 28 | $null = $PSBoundParameters.Remove('Namespace') 29 | } 30 | } 31 | If ($PSBoundParameters.ContainsKey('verbose')) 32 | { 33 | $null = $PSBoundParameters.Remove('verbose') 34 | } 35 | $Body = @{ 36 | webhook = $webhook 37 | } 38 | $null = $PSBoundParameters.Remove('webhook') 39 | try 40 | { 41 | $Request = @{ 42 | URI = "/projects/$($Project.id)/services/slack" 43 | Method = 'PUT' 44 | Body = $Body 45 | ContentType = 'application/x-www-form-urlencoded' 46 | } 47 | $Body 48 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Project.Service.Slack' 49 | } 50 | catch 51 | { 52 | Write-Error -Message $_ 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /PSGitLab/Public/Projects/Set-GitLabProjectWebhook.ps1: -------------------------------------------------------------------------------- 1 | Function Set-GitLabProjectWebhook 2 | { 3 | 4 | [OutputType('GitLab.Project.Webhook')] 5 | [cmdletbinding()] 6 | param( 7 | [ValidateNotNull()] 8 | [ValidateNotNullOrEmpty()] 9 | [Parameter(ParameterSetName = 'Id')] 10 | [string]$Id, 11 | 12 | [ValidateNotNull()] 13 | [ValidateNotNullOrEmpty()] 14 | #[Parameter(ParameterSetName='Namespace')] 15 | [string]$Namespace, 16 | [parameter(mandatory,HelpMessage='Webhook URL')][string]$URL, 17 | [parameter(mandatory,HelpMessage='Hook ID')][string]$hook_id, 18 | [switch]$push_events, 19 | [switch]$issues_events, 20 | [switch]$merge_requests_events, 21 | [switch]$tag_push_events, 22 | [switch]$note_events, 23 | [switch]$pipeline_events, 24 | [switch]$wiki_events, 25 | [switch]$enable_ssl_verification, 26 | [string]$Token 27 | 28 | ) 29 | 30 | $Project = $null 31 | switch ($PSCmdlet.ParameterSetName) { 32 | 'Id' 33 | { 34 | $Project = Get-GitLabProject -Id $Id 35 | $null = $PSBoundParameters.Remove('Id') 36 | } 37 | 'Namespace' 38 | { 39 | $Project = Get-GitLabProject -Namespace $Namespace 40 | $null = $PSBoundParameters.Remove('Namespace') 41 | } 42 | } 43 | If ($PSBoundParameters.ContainsKey('verbose')) 44 | { 45 | $null = $PSBoundParameters.Remove('verbose') 46 | } 47 | $Body = @{ 48 | id = $Project.id 49 | url = $URL 50 | } 51 | $null = $PSBoundParameters.Remove('URL') 52 | try 53 | { 54 | foreach($p in $PSBoundParameters.GetEnumerator()) 55 | { 56 | $Body.Add($p.Key, $($p.Value)) 57 | } 58 | 59 | $Request = @{ 60 | URI = "/projects/$($Project.id)/hooks/$hook_id" 61 | Method = 'PUT' 62 | Body = $Body 63 | ContentType = 'application/x-www-form-urlencoded' 64 | } 65 | $Body 66 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Project.Webhook' 67 | } 68 | catch 69 | { 70 | Write-Error -Message $_ 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /PSGitLab/Public/Projects/Start-GitLabPipeline.ps1: -------------------------------------------------------------------------------- 1 | Function Start-GitLabPipeline { 2 | [OutputType("GitLab.Project.Pipeline")] 3 | param( 4 | 5 | [Parameter(Mandatory=$true)] 6 | [int]$ProjectID, 7 | 8 | [Parameter(Mandatory=$true, ParameterSetName='ByBranch')] 9 | [String]$Branch, 10 | 11 | [Parameter(Mandatory=$true, ParameterSetName='ByTag')] 12 | [String]$Tag 13 | 14 | ) 15 | 16 | $Request = @{ 17 | URI = '' 18 | Method = 'POST' 19 | } 20 | 21 | $Project = Get-GitlabProject -Id $ProjectId 22 | 23 | Write-Verbose -Message "Starting a pipeline for the project $($Project.Name) and id $($Project.Id)" 24 | 25 | if ($PSCmdlet.ParameterSetName -eq 'ByBranch') { 26 | $ref=$Branch 27 | } 28 | elseif ($PSCmdlet.ParameterSetName -eq 'ByTag') { 29 | $ref=$Tag 30 | } 31 | 32 | $Request.URI= "/projects/$($Project.id)/pipeline/?ref=$ref" 33 | 34 | Write-Verbose -Message "A prepared API request: $($($Request.URI).ToString())" 35 | 36 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Project.Pipeline' 37 | 38 | } 39 | -------------------------------------------------------------------------------- /PSGitLab/Public/Projects/Stop-GitLabPipeline.ps1: -------------------------------------------------------------------------------- 1 | Function Stop-GitLabPipeline { 2 | [OutputType("GitLab.Project.Pipeline")] 3 | param( 4 | 5 | [Parameter(Mandatory=$true)] 6 | [int]$ProjectID, 7 | 8 | [Parameter(Mandatory=$true)] 9 | [int]$Id 10 | 11 | ) 12 | 13 | $Request = @{ 14 | URI = '' 15 | Method = 'GET' 16 | } 17 | 18 | $Project = Get-GitlabProject -Id $ProjectId 19 | 20 | Write-Verbose -Message "Stoping a pipeline for the project $($Project.Name) and id $($Project.Id)" 21 | 22 | $Pipeline = Get-GitLabPipeline -Id $ProjectID -Id $Id 23 | 24 | if (@('running', 'pending') -contains $Pipeline.status ) { 25 | 26 | $Request.URI= "/projects/$($Project.id)/pipelines/$Id/cancel" 27 | 28 | Write-Verbose -Message "A prepared API request: $($($Request.URI).ToString())" 29 | 30 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Project.Pipeline' 31 | 32 | } 33 | else { 34 | 35 | Write-Warning -Message "The status for the pipeline $Id is $PipelineId so it can't be canceled." 36 | 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /PSGitLab/Public/Runners/Add-GitLabProjectRunner.ps1: -------------------------------------------------------------------------------- 1 | Function Add-GitLabProjectRunner { 2 | param( 3 | [Parameter(Mandatory=$true)] 4 | [int]$RunnerId, 5 | 6 | [Parameter(Mandatory=$true)] 7 | [int]$ProjectId) 8 | 9 | $Body = @{ 10 | runner_id = $RunnerId 11 | } 12 | 13 | $Request = @{ 14 | URI="/projects/$ProjectId/runners"; 15 | Method='POST'; 16 | Body=$Body; 17 | ContentType='application/x-www-form-urlencoded'; 18 | } 19 | 20 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Runner' 21 | } 22 | -------------------------------------------------------------------------------- /PSGitLab/Public/Runners/Get-GitLabRunner.ps1: -------------------------------------------------------------------------------- 1 | Function Get-GitLabRunner { 2 | [cmdletbinding(DefaultParameterSetName='Single')] 3 | [OutputType("GitLab.Runner")] 4 | param( 5 | [Parameter(ParameterSetName='Single', 6 | Mandatory=$true)] 7 | [int]$Id, 8 | 9 | [Parameter(ParameterSetName='Project', 10 | Mandatory=$true)] 11 | [int]$ProjectId, 12 | 13 | [Parameter(ParameterSetName='Owned', 14 | Mandatory=$true)] 15 | [switch]$Owned, 16 | 17 | [Parameter(ParameterSetName='All', 18 | Mandatory=$true)] 19 | [switch]$All, 20 | 21 | [Parameter(Mandatory=$false, 22 | HelpMessage='Limit by scope', 23 | ParameterSetName='Owned')] 24 | [Parameter(Mandatory=$false, 25 | HelpMessage='Limit by scope', 26 | ParameterSetName='All')] 27 | [ValidateSet("active", "paused", "online")] 28 | $Scope = $null 29 | ) 30 | 31 | if ($PSCmdlet.ParameterSetName -ne 'Single') { 32 | Write-Verbose "Create GET Request" 33 | $GetUrlParameters = @() 34 | if ($Scope) { 35 | $GetUrlParameters += @{scope=$Scope} 36 | } 37 | 38 | $URLParameters = GetMethodParameters -GetURLParameters $GetUrlParameters 39 | Write-Host $URLParameters 40 | } 41 | 42 | $Request = @{ 43 | URI = '' 44 | Method = 'GET' 45 | } 46 | 47 | Write-Verbose "Parameter Set Name: $($PSCmdlet.ParameterSetName)" 48 | 49 | switch ($PSCmdlet.ParameterSetName) { 50 | Single { $Request.URI = "/runners/$Id"; break; } 51 | Owned { $Request.URI = "/runners/$URLParameters"; break; } 52 | All { $Request.URI="/runners/all$URLParameters"; break; } 53 | Project { $Request.URI="/projects/$ProjectId/runners"; break; } 54 | } 55 | 56 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Runner' 57 | } 58 | -------------------------------------------------------------------------------- /PSGitLab/Public/Runners/New-GitLabRunner.ps1: -------------------------------------------------------------------------------- 1 | Function New-GitLabRunner { 2 | param( 3 | [Parameter(Mandatory=$true)] 4 | [string] $Token, 5 | 6 | [Parameter(Mandatory=$true)] 7 | [string] $Description, 8 | 9 | [Parameter(Mandatory=$true)] 10 | [string] $Tags, 11 | 12 | [bool] $RunUntagged = $false, 13 | [bool] $Locked = $true, 14 | 15 | [Parameter(Mandatory=$true)] 16 | [string] $Platform = "linux", 17 | 18 | [Parameter(Mandatory=$true)] 19 | [string] $Architecture = "amd64", 20 | 21 | [Parameter(Mandatory=$true)] 22 | [ValidateSet("shell", "docker", "docker-ssh", "ssh", "parallels", "virtualbox", "docker+machine", "docker-ssh+machine", "kubernetes")] 23 | [string] $Executor = "shell", 24 | 25 | [bool] $Artifacts = $true, 26 | [bool] $Cache = $true, 27 | [bool] $Image = $true, 28 | [bool] $Services = $true, 29 | [bool] $Shared = $true, 30 | [bool] $Variables = $true, 31 | 32 | [Parameter(Mandatory=$true)] 33 | [string] $Name, 34 | 35 | [Parameter(Mandatory=$true)] 36 | [string] $Revision = "c1ecf97f", 37 | 38 | [Parameter(Mandatory=$true)] 39 | [string] $Version = "10.1.0" 40 | ) 41 | 42 | $requestObject = @{ 43 | "info" = @{ 44 | "name" = $Name; 45 | "version" = $Version; 46 | "revision" = $Revision; 47 | "platform" = $Platform; 48 | "architecture" = $Architecture; 49 | "executor" = $Executor; 50 | "features" = @{ 51 | "variables" = $Variables; 52 | "image" = $Image; 53 | "services" = $Services; 54 | "artifacts" = $Artifacts; 55 | "cache" = $Cache; 56 | "shared" = $Shared; 57 | }; 58 | }; 59 | "token" = $Token; 60 | "description" = $Description; 61 | "tag_list" = $Tags; 62 | "run_untagged" = $RunUntagged; 63 | "locked" = $locked; 64 | } 65 | 66 | $Body = ConvertTo-Json $requestObject 67 | 68 | $Request = @{ 69 | URI='/runners'; 70 | Method='POST'; 71 | Body=$Body; 72 | ContentType="application/json" 73 | } 74 | 75 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Runner' 76 | } 77 | -------------------------------------------------------------------------------- /PSGitLab/Public/Runners/Remove-GitLabProjectRunner.ps1: -------------------------------------------------------------------------------- 1 | Function Remove-GitLabProjectRunner { 2 | param( 3 | [Parameter(Mandatory=$true)] 4 | [int]$RunnerId, 5 | 6 | [Parameter(Mandatory=$true)] 7 | [int]$ProjectId) 8 | 9 | $Request = @{ 10 | URI="/projects/$ProjectId/runners/$RunnerId"; 11 | Method='DELETE'; 12 | } 13 | 14 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Runner' 15 | } 16 | -------------------------------------------------------------------------------- /PSGitLab/Public/Runners/Remove-GitLabRunner.ps1: -------------------------------------------------------------------------------- 1 | Function Remove-GitLabRunner { 2 | param( 3 | [Parameter(Mandatory=$true)] 4 | [int]$Id) 5 | 6 | $Request = @{ 7 | URI="/runners/$Id"; 8 | Method='DELETE'; 9 | } 10 | 11 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Runner' 12 | } 13 | -------------------------------------------------------------------------------- /PSGitLab/Public/Runners/Set-GitLabRunner.ps1: -------------------------------------------------------------------------------- 1 | Function Set-GitLabRunner { 2 | param( 3 | [Parameter(Mandatory=$true)] 4 | [int]$Id, 5 | 6 | [string]$Description, 7 | 8 | # See http://itproctology.blogspot.be/2014/03/powershell-passing-empty-parameters-and.html 9 | # for the rationale for this 10 | [ValidateSet("True","False","", 0, 1)] 11 | [string]$Active, 12 | [string]$Tags, 13 | 14 | [ValidateSet("True","False","", 0, 1)] 15 | [string]$RunUntagged, 16 | 17 | [ValidateSet("True","False","", 0, 1)] 18 | [string]$Locked, 19 | 20 | [ValidateSet("not_protected", "ref_protected")] 21 | [string]$AccessLevel) 22 | 23 | $Body = @{} 24 | 25 | 26 | if ($Description) { $Body.Add('description',$Description) } 27 | if ($Active) { $Body.Add('active',$active) } 28 | if ($Tags) { $Body.Add('tag_list', $Tags) } 29 | if ($RunUntagged) { $Body.Add('run_untagged', $RunUntagged) } 30 | if ($Locked) {$Body.Add('locked', $Locked) } 31 | if ($AccessLevel) { $Body.Add('access_level', $AccessLevel) } 32 | 33 | Write-Host (ConvertTo-Json $Body) 34 | 35 | $Request = @{ 36 | URI="/runners/$Id"; 37 | Method='PUT'; 38 | Body=$Body; 39 | ContentType='application/x-www-form-urlencoded'; 40 | } 41 | 42 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.Runner' 43 | } 44 | -------------------------------------------------------------------------------- /PSGitLab/Public/User/Block-GitLabUser.ps1: -------------------------------------------------------------------------------- 1 | Function Block-GitLabUser { 2 | [cmdletbinding(DefaultParameterSetName='ID')] 3 | param( 4 | [Parameter(Mandatory=$True, 5 | ParameterSetName='ID', 6 | ValueFromPipelineByPropertyName=$true)] 7 | [string]$ID, 8 | 9 | [Parameter(Mandatory=$True, 10 | ParameterSetName='Username')] 11 | [string]$Username, 12 | 13 | [Parameter(Mandatory=$True, 14 | ParameterSetName='Email')] 15 | [string]$Email, 16 | 17 | [switch] $Passthru = $false 18 | ) 19 | 20 | BEGIN {} 21 | 22 | PROCESS { 23 | 24 | Write-Verbose "$ID" 25 | switch ($PScmdlet.ParameterSetName ) { 26 | 'Email' { $User = Get-GitLabUser -Email $Email } 27 | 'Username' { $User = Get-GitLabUser -Username $UserName } 28 | 'ID' { $User = Get-GitLabUser -id $ID } 29 | } 30 | 31 | if ( -not $User ) { 32 | Write-Error "User does not exist" 33 | } 34 | 35 | $request = @{ 36 | URI = "/users/$($User.ID)/block" 37 | Method = 'POST' 38 | } 39 | 40 | $null = QueryGitLabAPI -Request $Request -ObjectType 'GitLab.User' 41 | if ($Passthru.IsPresent) { 42 | Get-GitLabuser -id $User.ID 43 | } 44 | 45 | } 46 | 47 | END {} 48 | 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /PSGitLab/Public/User/Get-GitLabUser.ps1: -------------------------------------------------------------------------------- 1 | Function Get-GitLabUser { 2 | [cmdletbinding(DefaultParameterSetName='All')] 3 | [OutputType('GitLab.User')] 4 | param( 5 | [Parameter(ParameterSetName='ID')] 6 | [string]$ID, 7 | 8 | [Parameter(ParameterSetName='All')] 9 | [switch]$All, 10 | 11 | [Parameter(ParameterSetName='Username')] 12 | [string]$Username, 13 | 14 | [Parameter(ParameterSetName='Email')] 15 | [string]$Email, 16 | 17 | [Parameter(ParameterSetName='CurrentUser')] 18 | [switch]$CurrentUser 19 | ) 20 | $Request = @{ 21 | URI = '/users' 22 | Method = 'GET' 23 | } 24 | 25 | switch ( $PSCmdlet.ParameterSetName) { 26 | 'ID' { $Request.URI = "/users/$ID" } 27 | 'All' { $Request.URI = '/users' } 28 | 'CurrentUser' { $Request.URI = '/user' } 29 | } 30 | 31 | if ( $PSCmdlet.ParameterSetName -eq 'Username') { 32 | 33 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.User' | where-object { $_.username -eq $Username } 34 | 35 | } elseif ( $PSCmdlet.ParameterSetName -eq 'Email') { 36 | 37 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.User' | where-object { $_.email -eq $email } 38 | 39 | } else { 40 | 41 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.User' 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /PSGitLab/Public/User/New-GitLabUser.ps1: -------------------------------------------------------------------------------- 1 | Function New-GitLabUser { 2 | [CmdletBinding()] 3 | param ( 4 | [ValidateNotNullOrEmpty()] 5 | [Parameter(Mandatory=$true)] 6 | [string]$Email, 7 | 8 | [ValidateNotNullOrEmpty()] 9 | [ValidatePattern("(?# Error: Password Must Contain at least 8 characters).{8,}")] 10 | [Parameter(Mandatory=$true)] 11 | [string]$Password, 12 | 13 | [ValidateNotNullOrEmpty()] 14 | [Parameter(Mandatory=$true)] 15 | [string]$Username, 16 | 17 | [ValidateNotNullOrEmpty()] 18 | [Parameter(Mandatory=$true)] 19 | [string]$Name, 20 | 21 | [string]$SkypeID = $null, 22 | [string]$LinkedIn = $null, 23 | [string]$Twitter = $null, 24 | [string]$WebsiteURL = $null, 25 | [int]$ProjectsLimit = $null, 26 | [switch]$Admin = $false, 27 | [switch]$CanCreateGroup = $false, 28 | [switch]$External = $false, 29 | [switch]$Passthru = $false 30 | ) 31 | 32 | $Body = @{ 33 | email = $Email 34 | password = $Password 35 | username = $Username 36 | name = $Name 37 | } 38 | 39 | $user = Get-GitLabUser -Username $UserName 40 | 41 | if ($user) { 42 | Write-Warning "$UserName already exists. Skipping..." 43 | } else { 44 | if ($PSBoundParameters.ContainsKey('SkypeID')) { $Body.Add('skype',$SkypeID) } 45 | if ($PSBoundParameters.ContainsKey('LinkedIn')) { $Body.Add('linkedin',$LinkedIn) } 46 | if ($PSBoundParameters.ContainsKey('Twitter')) { $Body.Add('twitter',$Twitter) } 47 | if ($PSBoundParameters.ContainsKey('WebsiteURL')) { $Body.Add('website_url',$WebsiteURL) } 48 | if ($PSBoundParameters.ContainsKey('ProjectsLimit')) { $Body.Add('projects_limit',$ProjectsLimit) } 49 | if ($Admin.IsPresent) { $Body.Add('admin','true') } 50 | if ($CanCreateGroup.IsPresent) { $Body.Add('can_create_group','true') } 51 | if ($External.IsPresent) { $Body.Add('external','true') } 52 | 53 | $Request = @{ 54 | URI = '/users' 55 | Method = 'POST' 56 | Body = $Body 57 | } 58 | 59 | $Results = QueryGitLabAPI -Request $Request -ObjectType 'GitLab.User' 60 | if ($Passthru.IsPresent) { 61 | $Results 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /PSGitLab/Public/User/Remove-GitLabUser.ps1: -------------------------------------------------------------------------------- 1 | Function Remove-GitLabUser { 2 | [cmdletbinding(SupportsShouldProcess=$True,ConfirmImpact='High')] 3 | param( 4 | [ValidateNotNull()] 5 | [ValidateNotNullOrEmpty()] 6 | [Parameter(Mandatory=$true, 7 | ValueFromPipelineByPropertyName=$true)] 8 | [string[]]$Username 9 | ) 10 | 11 | BEGIN {} 12 | 13 | PROCESS { 14 | foreach ( $user in $Username ) { 15 | 16 | $UserInfo = (Get-GitLabUser -Username $User) 17 | if ( -not $UserInfo ) { 18 | Write-Error "User does not exist" 19 | } 20 | 21 | Write-Verbose "$($UserInfo.Username)" 22 | $Request = @{ 23 | URI="/users/$($UserInfo.ID)" 24 | Method = 'DELETE' 25 | } 26 | 27 | if ( $PSCmdlet.ShouldProcess("Delete User $Username") ) { 28 | $Results = QueryGitLabAPI -Request $Request -ObjectType 'GitLab.User' 29 | } 30 | 31 | } 32 | 33 | } 34 | 35 | END {} 36 | 37 | } 38 | -------------------------------------------------------------------------------- /PSGitLab/Public/User/Search-GitLabUser.ps1: -------------------------------------------------------------------------------- 1 | Function Search-GitLabUser { 2 | [cmdletbinding()] 3 | param( 4 | [Parameter(Mandatory=$true)] 5 | [string]$User 6 | ) 7 | 8 | $Request = @{ 9 | URI="/users?search=$($User)"; 10 | Method='Get'; 11 | } 12 | QueryGitLabAPI -Request $Request -ObjectType 'GitLab.User' -Version "v4" 13 | } 14 | -------------------------------------------------------------------------------- /PSGitLab/Public/User/Set-GitLabUser.ps1: -------------------------------------------------------------------------------- 1 | Function Set-GitLabUser { 2 | [cmdletbinding()] 3 | param( 4 | [ValidateNotNullOrEmpty()] 5 | [Parameter(Mandatory=$true,ParameterSetName='ID')] 6 | [string]$ID, 7 | 8 | [ValidateNotNullOrEmpty()] 9 | [Parameter(Mandatory=$true,ParameterSetName='Email')] 10 | [string]$Email, 11 | 12 | [ValidateNotNullOrEmpty()] 13 | [Parameter(Mandatory=$true,ParameterSetName='Username')] 14 | [string]$Username, 15 | 16 | #[string]$NewEmail = $null, 17 | [string]$Password = $null, 18 | [string]$NewUsername = $null, 19 | [string]$Name = $null, 20 | [string]$SkypeID = $null, 21 | [string]$LinkedIn = $null, 22 | [string]$Twitter = $null, 23 | [string]$WebsiteURL = $null, 24 | [int]$ProjectsLimit = $null, 25 | [switch]$Admin = $false, 26 | [switch]$CanCreateGroup = $false, 27 | [switch]$External = $false, 28 | 29 | [switch]$Passthru = $false 30 | ) 31 | 32 | switch ($PScmdlet.ParameterSetName ) { 33 | 'Email' { $User = Get-GitLabUser -Email $Email } 34 | 'Username' { $User = Get-GitLabUser -Username $UserName } 35 | 'ID' { $User = Get-GitLabUser -id $ID } 36 | } 37 | 38 | if ( -not $User ) { 39 | Write-Error "User does not exist" 40 | } 41 | 42 | $Body = @{} 43 | 44 | #if ($NewEmail) { $Body.Add('email',$NewEmail) } 45 | if ($PSBoundParameters.ContainsKey('Password')) { $Body.Add('password',$Password) } 46 | if ($PSBoundParameters.ContainsKey('NewUsername')) { $Body.Add('username',$NewUsername) } 47 | if ($PSBoundParameters.ContainsKey('Name')) { $Body.Add('name',$Name) } 48 | if ($PSBoundParameters.ContainsKey('SkypeID')) { $Body.Add('skype',$SkypeID) } 49 | if ($PSBoundParameters.ContainsKey('LinkedIn')) { $Body.Add('linkedin',$LinkedIn) } 50 | if ($PSBoundParameters.ContainsKey('Twitter')) { $Body.Add('twitter',$Twitter) } 51 | if ($PSBoundParameters.ContainsKey('WebsiteURL')) { $Body.Add('website_url',$WebsiteURL) } 52 | if ($PSBoundParameters.ContainsKey('ProjectsLimit')) { $Body.Add('projects_limit',$ProjectsLimit) } 53 | if ($Admin.IsPresent) { $Body.Add('admin','true') } 54 | if ($CanCreateGroup.IsPresent) { $Body.Add('can_create_group','true') } 55 | if ($External.IsPresent) { $Body.Add('external','true') } 56 | $Request = @{ 57 | URI = "/users/$($User.ID)" 58 | Method = 'PUT' 59 | Body = $Body 60 | ContentType = 'application/x-www-form-urlencoded' 61 | } 62 | 63 | Write-Verbose "Body: $( $Body | ConvertTo-Json ) " 64 | 65 | $Results = QueryGitLabAPI -Request $Request -ObjectType 'GitLab.User' 66 | if ($Passthru.IsPresent) { 67 | $Results 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /PSGitLab/Public/User/Unblock-GitLabUser.ps1: -------------------------------------------------------------------------------- 1 | Function Unblock-GitLabUser { 2 | [cmdletbinding(DefaultParameterSetName='ID')] 3 | param( 4 | [Parameter(Mandatory=$True, 5 | ParameterSetName='ID', 6 | ValueFromPipelineByPropertyName=$true)] 7 | [string]$ID, 8 | 9 | [Parameter(Mandatory=$True, 10 | ParameterSetName='Username')] 11 | [string]$Username, 12 | 13 | [Parameter(Mandatory=$True, 14 | ParameterSetName='Email')] 15 | [string]$Email, 16 | 17 | [switch] $Passthru = $false 18 | ) 19 | 20 | BEGIN {} 21 | 22 | PROCESS { 23 | 24 | Write-Verbose "$ID" 25 | switch ($PScmdlet.ParameterSetName ) { 26 | 'Email' { $User = Get-GitLabUser -Email $Email } 27 | 'Username' { $User = Get-GitLabUser -Username $UserName } 28 | 'ID' { $User = Get-GitLabUser -id $ID } 29 | } 30 | 31 | if ( -not $User ) { 32 | Write-Error "User does not exist" 33 | } 34 | 35 | $request = @{ 36 | URI = "/users/$($User.ID)/unblock" 37 | Method = 'POST' 38 | } 39 | 40 | $null = QueryGitLabAPI -Request $Request -ObjectType 'GitLab.User' 41 | if ($Passthru.IsPresent) { 42 | Get-GitLabuser -id $User.ID 43 | } 44 | 45 | } 46 | 47 | END {} 48 | 49 | 50 | } 51 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | An interface for administering GitLab from a Windows PC using PowerShell. 2 | 3 | [![Build status](https://ci.appveyor.com/api/projects/status/t7wyv5xim2olu0r7/branch/master?svg=true)](https://ci.appveyor.com/project/ngetchell/psgitlab/branch/master) 4 | 5 | ## Installation 6 | ```PowerShell 7 | Find-Module -Name PSGitLab | Install-Module 8 | ``` 9 | 10 | ## Getting started 11 | Before you start to use PSGitLab you need to 12 | - obtain your your [personal access token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html) 13 | - save your personal access token and the GitLab URL using Save-GitLabAPIConfiguration 14 | 15 | ```PowerShell 16 | Save-GitLabAPIConfiguration -Domain https://my-gitlab.example.com -Token "mPnTssWyBCMjxxxxxxxJQ" 17 | ``` 18 | 19 | Your configuration data are saved to the file "$env:appdata\PSGitLab\PSGitLabConfiguration.xml". 20 | 21 | ## API Requests 22 | If you think there is an [GitLab API](https://docs.gitlab.com/ce/api/README.html) I missed make sure to request it as an issue. 23 | I added the API calls that I needed to get work done. 24 | You might need others. 25 | Let me know. 26 | 27 | ## Contributing 28 | Before issuing a Pull Request make sure to run the following code to make sure your not additions don't get kicked back. 29 | 30 | ``` PowerShell 31 | .\build.ps1 -Task Pre-Commit 32 | ``` 33 | 34 | This will run your code against the PSScriptAnalyzer and Pester tests. 35 | If you're writing code against a specific function you can use Pester tags to check against just that one function. 36 | 37 | ``` PowerShell 38 | Invoke-Pester -Tag get-gitlabproject 39 | ``` 40 | 41 | ### Milestones 42 | Milestones will be used for code coverage. Each API call has it's own issue and each group of API calls will be categorized by the corresponding milestone. 43 | 44 | ### Issues 45 | If you find a bug, please let me know through the issue tracker. The more details you provide the better. 46 | 47 | ### Contributors 48 | - [Nicholas M. Getchell](https://github.com/ngetchell) - [@getch3028](https://twitter.com/getch3028) 49 | - [Leonhard Schick](https://github.com/lw-schick) 50 | - [Brooks Collins](https://github.com/TerrapinStation) 51 | - [Matthew Hilton](https://github.com/matt2005) 52 | - [Wojciech Sciesinski](https://github.com/it-praktyk) - [ITpraktyk](https://twitter.com/ITpraktyk) 53 | - [Robin Malik](https://github.com/robinmalik) - [@robinmalik](https://twitter.com/robinmalik) 54 | -------------------------------------------------------------------------------- /ReleaseNotes.md: -------------------------------------------------------------------------------- 1 | ## 3.0.1 (2018-10-02) 2 | 3 | ### Changes 4 | 5 | * 7f4fbef - Nicholas M. Getchell : Fixes the null length return for all 204 status codes and fixes the ALL 404 (#197) 6 | 7 | 8 | ## 3.0.0 (2018-09-24) 9 | 10 | ### Changes 11 | 12 | * b633d5f - Nicholas M. Getchell : Adds new error status codes. (#195) 13 | * 062bb6d - Simon Heather : Fix always returning archived projects (#193) 14 | * 5fb4549 - Nicholas M. Getchell : Properly queries request URI for Get param prefix. (#190) 15 | * f4d39ba - Nicholas M. Getchell : Move from PUT to POST for Blcok and Unblock users. (#191) 16 | * b5cfaed - Eduardo de Moura Rodrigues : Add basic groups endpoint (#186) 17 | * 2729d09 - Simon Heather : Disable Invoke-WebRequest Progress Bar (#183) 18 | * df7184b - Wojciech Sciesinski : Code cleanup (#172) 19 | * cb53bd2 - Nicholas M. Getchell : Various Issues (#181) 20 | * b066472 - Nicholas M. Getchell : Adds support for the TLS 1.2 protocol (#179) 21 | * ddf19bb - Robin Malik : Addition: GitLab Issues (#175) 22 | -------------------------------------------------------------------------------- /Tests/Integration/Install.ps1: -------------------------------------------------------------------------------- 1 | $ProgressPreference = 'Silent' 2 | $WarningPreference = 'Silent' 3 | 4 | 5 | $Token = Get-Random 6 | $ContainerName = 'gitlab' 7 | $URI = 'http://localhost' 8 | 9 | Write-Host "Checking Status of gitlab container" 10 | 11 | $Inspect = docker inspect $ContainerName | ConvertFrom-Json 12 | if ( $Inspect.State.Status -ne 'running' ) { 13 | Write-Host "Starting $ContainerName" 14 | docker run --detach --hostname gitlab.example.com --env GITLAB_OMNIBUS_CONFIG="external_url '$URI'; gitlab_rails['lfs_enabled'] = true; gitlab_rails['initial_root_password'] = 'longterriblepassword!' " --publish 4433:433 --publish 80:80 --publish 2222:22 --name $ContainerName --restart always gitlab/gitlab-ce:latest 15 | } 16 | 17 | Write-Host "Waiting for $ContainerName to start web server." 18 | $StartTime = Get-Date 19 | do { 20 | Start-Sleep -Seconds 5 21 | $StatusCode = docker exec -ti gitlab curl -s -o /dev/null -w "%{http_code}" localhost 22 | $Timespent = (Get-Date).Subtract($StartTime) 23 | "Time Elapsed: {0}" -f [math]::Round($Timespent.TotalSeconds) 24 | } while ( $StatusCode -ne 302 -or $Timespent.Minutes -gt 10 ) 25 | Write-Host "Web server started and is properly redirecting." 26 | 27 | Write-Host "Setting Personal Access Token to $Token" 28 | docker exec -ti -u git gitlab gitlab-rails r "token = PersonalAccessToken.new(user: User.where(id: 1).first, name: 'temp token13', token: '$Token', scopes: ['api','read_user','sudo']); token.save"'!' 29 | 30 | Install-Module PSGitLab -Scope CurrentUser -Force 31 | 32 | Save-GitLabAPIConfiguration -Token $Token -Domain 'http://localhost' 33 | 34 | Test-GitLabAPI -------------------------------------------------------------------------------- /Tests/PSGitLab.Tests.ps1: -------------------------------------------------------------------------------- 1 | $ModuleName = 'PSGitLab' 2 | Get-Module $ModuleName | Remove-Module 3 | $ModulePath = "$PSScriptRoot\..\PSGitLab\" 4 | 5 | Import-Module $ModulePath 6 | 7 | #region Save-GitLabAPIConfiguration 8 | 9 | #Describe 'Save-GitLabAPIConfigruation' { 10 | # It 'Proper Format' { 11 | # { Save-GitLabAPIConfiguration -Domain http://gitlab.com -Token 'TestInformation' } | Should not throw 12 | # } 13 | # 14 | # It 'Malformed URI' { 15 | # { Save-GitlabAPIConfiguration -Domain httpffsdf -Token 'TestInformation' } | Should throw 16 | # } 17 | # 18 | # It 'No Domain' { 19 | # { Save-GitLabAPIConfiguration -Token 'Test' -Domain $null } | Should Throw 20 | # } 21 | # 22 | # It 'No Token' { 23 | # { Save-GitLabAPIConfiguration -Domain 'http://gitlab.com' -Token $null } | Should Throw 24 | # } 25 | #} 26 | 27 | #Describe 'ImportConfig' { 28 | # $Token = (Get-date -Format yy-mm-dd-HH) 29 | # Save-GitLabAPIConfiguration -Domain 'http://gitlab.com' -Token $Token 30 | # 31 | # InModuleScope PSGitLab { 32 | # it 'Domain Test' { 33 | # $Config = ImportConfig 34 | # $Config.Domain | SHould be 'http://gitlab.com' 35 | # } 36 | # 37 | # It 'Token Test' { 38 | # $Config = ImportConfig 39 | # $Config.Token | Should be (Get-date -Format yy-mm-dd-HH) 40 | # } 41 | # 42 | # } 43 | #} 44 | 45 | Describe 'Module Information' { 46 | 47 | $ModuleManifest = Resolve-Path "$ModulePath\$ModuleName.psd1" 48 | 49 | Context 'Module Manifest' { 50 | $Script:Manifest = $null 51 | It 'Valid Manifest File' { 52 | { 53 | $Script:Manifest = Test-ModuleManifest -Path $ModuleManifest -ErrorAction Stop -WarningAction SilentlyContinue 54 | } | Should Not Throw 55 | } 56 | 57 | It 'Valid Manifest Root Module' { 58 | $Script:Manifest.RootModule | Should Be 'PSGitLab.psm1' 59 | } 60 | 61 | It 'Valid Manifest Name' { 62 | $Script:Manifest.Name | Should be PSGitLab 63 | } 64 | 65 | It 'Valid Manifest GUID' { 66 | $Script:Manifest.Guid | Should be 'f844db87-fda8-403b-a7da-bdc00a3f5a58' 67 | } 68 | 69 | It 'Valid Manifest Version' { 70 | $Script:Manifest.Version -as [Version] | Should Not BeNullOrEmpty 71 | } 72 | 73 | It 'Valid Manifest Description' { 74 | $Script:Manifest.Description | Should Not BeNullOrEmpty 75 | } 76 | 77 | It 'Valid Format File' { 78 | $ValidPath = Test-Path -Path $Script:Manifest.ExportedFormatFiles 79 | $ValidPath | Should be $true 80 | } 81 | 82 | It 'Required Modules' { 83 | $Script:Manifest.RequiredModules | Should BeNullOrEmpty 84 | } 85 | 86 | It 'Non blank description' { 87 | $Script:Manifest.Description | Should not Benullorempty 88 | } 89 | 90 | } 91 | } 92 | 93 | 94 | #endregion Save-GitLabAPIConfiguration 95 | Remove-Module $ModuleName 96 | -------------------------------------------------------------------------------- /appveyor.yml.old: -------------------------------------------------------------------------------- 1 | 2 | # See http://www.appveyor.com/docs/appveyor-yml for many more options 3 | # Fron https://github.com/RamblingCookieMonster/PSStackExchange/blob/master/appveyor.yml 4 | # Additional: https://dfinke.github.io/powershell/2018/01/23/PowerShell-Testing-Your-Scripts-For-v5-and-v6.html 5 | 6 | environment: 7 | PSGalleryApiKey: 8 | secure: VGPEr3cXooAZfvnmzCzZ9i0i1Y2pc7BW2k0bWjCkV7WvD+0vKyiy+WwNH12rEdqc 9 | 10 | skip_commits: 11 | message: /updated readme.*|update readme.*s/ 12 | 13 | build: false 14 | 15 | test_script: 16 | # Test with native PS version 17 | - pwsh: . .\build.ps1 -task Clean,Pester 18 | - ps: . .\build.ps1 -task Clean,Deploy 19 | 20 | artifacts: 21 | - path: Release 22 | name: Release -------------------------------------------------------------------------------- /build.ps1: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/devblackops/POSHOrigin/blob/master/build.ps1 2 | 3 | [cmdletbinding()] 4 | param( 5 | [string[]]$Task = 'Pre-Commit' 6 | ) 7 | if ($IsWindows) { 8 | if ( -not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]"Administrator") ) { 9 | Write-Error "Build Script Requires Admin Rights" 10 | break; 11 | } 12 | } 13 | 14 | function Resolve-Module { 15 | [Cmdletbinding()] 16 | param ( 17 | [Parameter(Mandatory, ValueFromPipeline)] 18 | [string[]]$Name 19 | ) 20 | 21 | Process { 22 | foreach ($ModuleName in $Name) { 23 | $Module = Get-Module -Name $ModuleName -ListAvailable 24 | Write-Verbose -Message "Resolving Module [$($ModuleName)]" 25 | 26 | if ($Module) { 27 | $Version = $Module | Measure-Object -Property Version -Maximum | Select-Object -ExpandProperty Maximum 28 | $GalleryVersion = Find-Module -Name $ModuleName -Repository PSGallery -Verbose:$false | 29 | Measure-Object -Property Version -Maximum | 30 | Select-Object -ExpandProperty Maximum 31 | 32 | if ($Version -lt $GalleryVersion) { 33 | Write-Verbose -Message "$($ModuleName) Installed Version [$($Version.tostring())] is outdated. Installing Gallery Version [$($GalleryVersion.tostring())]" 34 | 35 | Install-Module -Name $ModuleName -Verbose:$false -Force -Repository PSGallery 36 | Import-Module -Name $ModuleName -Verbose:$false -Force -RequiredVersion $GalleryVersion 37 | } 38 | else { 39 | Write-Verbose -Message "Module Installed, Importing [$($ModuleName)]" 40 | Import-Module -Name $ModuleName -Verbose:$false -Force -RequiredVersion $Version 41 | } 42 | } 43 | else { 44 | Write-Verbose -Message "[$($ModuleName)] Missing, installing Module" 45 | Install-Module -Name $ModuleName -Verbose:$false -Force -Repository PSGallery 46 | Import-Module -Name $ModuleName -Verbose:$false -Force -RequiredVersion $Version 47 | } 48 | } 49 | } 50 | } 51 | 52 | Get-PackageProvider -Name Nuget -ForceBootstrap | Out-Null 53 | Set-PSRepository -Name PSGallery -InstallationPolicy Trusted 54 | 55 | 'BuildHelpers', 'InvokeBuild', 'Pester', 'PSDeploy', 'PSScriptAnalyzer', 'PlatyPS' | Resolve-Module 56 | 57 | Invoke-Build $Task 58 | -------------------------------------------------------------------------------- /docker/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | gitlab: 4 | image: gitlab/gitlab-ce 5 | container_name: gitlab 6 | entrypoint: init/docker-entrypoint 7 | environment: 8 | - EXTERNAL_PORT=8080 9 | - GITHUB_ACTIONS=${GITHUB_ACTIONS} 10 | ports: 11 | - 8080:80 12 | - 8443:443 13 | volumes: 14 | - ./docker-entrypoint:/init/docker-entrypoint 15 | - ./init:/init/init 16 | - ./test.rb:/init/test.rb 17 | - ./config:/config 18 | test: 19 | image: mcr.microsoft.com/powershell:latest 20 | environment: 21 | - GITHUB_ACTIONS=${GITHUB_ACTIONS} 22 | command: > 23 | pwsh -c "Install-Module Pester,PSScriptAnalyzer,Psake -Scope CurrentUser -force"; 24 | pwsh -File /PSGitlab/run-tests.ps1 25 | container_name: gitlab-ps 26 | volumes: 27 | - ../.:/PSGitlab 28 | - ./config:/config 29 | links: 30 | - gitlab -------------------------------------------------------------------------------- /docker/docker-entrypoint: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## Running the init logic for gitlab. 4 | /bin/bash init/init 5 | 6 | echo Sleep for 30 seconds to ensure all services are running 7 | sleep 30 8 | 9 | echo Initalize test token and user 10 | PERSONAL_ACCESS_TOKEN="$(gitlab-rails r /init/test.rb)" 11 | GITLAB_URL="http://localhost:$EXTERNAL_PORT" 12 | 13 | echo "$PERSONAL_ACCESS_TOKEN" >> /config/token 14 | 15 | echo Tail and wait 16 | gitlab-ctl tail& 17 | wait -------------------------------------------------------------------------------- /docker/test.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | u = User.first 3 | u.password_automatically_set = false 4 | u.password = 'password' 5 | u.password_confirmation = 'password' 6 | u.save! 7 | 8 | t = PersonalAccessToken.new({ user: u, name: 'ps-gitlab', scopes: ['api']}) 9 | t.save! 10 | 11 | puts t.token -------------------------------------------------------------------------------- /docs/Add-GitLabProjectRunner.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Add-GitLabProjectRunner 9 | 10 | ## SYNOPSIS 11 | Enable an available specific runner in the project. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Add-GitLabProjectRunner -RunnerId -ProjectId [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Enable an available specific runner in the project. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Add-GitLabProjectRunner -RunnerId 400 -ProjectId 500 27 | ``` 28 | 29 | ## PARAMETERS 30 | 31 | ### -RunnerId 32 | The ID of the GitLab runner to enable on the project. 33 | 34 | ```yaml 35 | Type: Int32 36 | Parameter Sets: (All) 37 | Aliases: 38 | 39 | Required: True 40 | Position: Named 41 | Default value: None 42 | Accept pipeline input: False 43 | Accept wildcard characters: False 44 | ``` 45 | 46 | ### -ProjectId 47 | The ID of the project on which to enable the runner. 48 | 49 | ```yaml 50 | Type: Int32 51 | Parameter Sets: (All) 52 | Aliases: 53 | 54 | Required: True 55 | Position: Named 56 | Default value: None 57 | Accept pipeline input: False 58 | Accept wildcard characters: False 59 | ``` 60 | 61 | ### CommonParameters 62 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 63 | 64 | ## INPUTS 65 | 66 | ## OUTPUTS 67 | 68 | ## NOTES 69 | 70 | ## RELATED LINKS 71 | 72 | [Enable a runner in a project](https://docs.gitlab.com/ce/api/runners.html#enable-a-runner-in-project) -------------------------------------------------------------------------------- /docs/Block-GitLabUser.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Block-GitLabUser 9 | 10 | ## SYNOPSIS 11 | Gives you the ability to block users in GitLab. 12 | 13 | ## SYNTAX 14 | 15 | ### ID (Default) 16 | ``` 17 | Block-GitLabUser -ID [-Passthru] [] 18 | ``` 19 | 20 | ### Username 21 | ``` 22 | Block-GitLabUser -Username [-Passthru] [] 23 | ``` 24 | 25 | ### Email 26 | ``` 27 | Block-GitLabUser -Email [-Passthru] [] 28 | ``` 29 | 30 | ## DESCRIPTION 31 | Gives you the ability to block users in GitLab. 32 | Can be done by parameter or by pipeline. 33 | 34 | ## EXAMPLES 35 | 36 | ### EXAMPLE 1 37 | ``` 38 | Block-GitLabUser -Username fake 39 | ``` 40 | 41 | ### EXAMPLE 2 42 | ``` 43 | Block-GitLabUser -Email fake@email.com 44 | ``` 45 | 46 | ### EXAMPLE 3 47 | ``` 48 | Block-GitLabUser -ID 22 49 | ``` 50 | 51 | ### EXAMPLE 4 52 | ``` 53 | Get-GitLabUser -Username fake | Block-GitLabUser 54 | ``` 55 | 56 | ## PARAMETERS 57 | 58 | ### -ID 59 | The GitLab user ID. 60 | 61 | ```yaml 62 | Type: String 63 | Parameter Sets: ID 64 | Aliases: 65 | 66 | Required: True 67 | Position: Named 68 | Default value: None 69 | Accept pipeline input: True (ByPropertyName) 70 | Accept wildcard characters: False 71 | ``` 72 | 73 | ### -Username 74 | The username of the user to be blocked. 75 | 76 | ```yaml 77 | Type: String 78 | Parameter Sets: Username 79 | Aliases: 80 | 81 | Required: True 82 | Position: Named 83 | Default value: None 84 | Accept pipeline input: False 85 | Accept wildcard characters: False 86 | ``` 87 | 88 | ### -Email 89 | The email of the user to be blocked. 90 | 91 | ```yaml 92 | Type: String 93 | Parameter Sets: Email 94 | Aliases: 95 | 96 | Required: True 97 | Position: Named 98 | Default value: None 99 | Accept pipeline input: False 100 | Accept wildcard characters: False 101 | ``` 102 | 103 | ### -Passthru 104 | Return the blocked user to the pipeline. 105 | 106 | ```yaml 107 | Type: SwitchParameter 108 | Parameter Sets: (All) 109 | Aliases: 110 | 111 | Required: False 112 | Position: Named 113 | Default value: False 114 | Accept pipeline input: False 115 | Accept wildcard characters: False 116 | ``` 117 | 118 | ### CommonParameters 119 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 120 | 121 | ## INPUTS 122 | 123 | ## OUTPUTS 124 | 125 | ## NOTES 126 | 127 | ## RELATED LINKS 128 | -------------------------------------------------------------------------------- /docs/Close-GitLabMergeRequest.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Close-GitLabMergeRequest 9 | 10 | ## SYNOPSIS 11 | Closes your GitLab merge requests. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Close-GitLabMergeRequest [-ProjectId] [-ID] [-Passthru] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Closes your GitLab merge requests. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Close-GitLabMergeRequest -ProjectId 8 -Id 32 27 | ``` 28 | 29 | ## PARAMETERS 30 | 31 | ### -ProjectId 32 | The ID of a project. 33 | 34 | ```yaml 35 | Type: String 36 | Parameter Sets: (All) 37 | Aliases: project_id 38 | 39 | Required: True 40 | Position: 1 41 | Default value: None 42 | Accept pipeline input: True (ByPropertyName) 43 | Accept wildcard characters: False 44 | ``` 45 | 46 | ### -ID 47 | The ID of the Merge request you'd like to close. 48 | 49 | ```yaml 50 | Type: String[] 51 | Parameter Sets: (All) 52 | Aliases: 53 | 54 | Required: True 55 | Position: 2 56 | Default value: None 57 | Accept pipeline input: True (ByPropertyName) 58 | Accept wildcard characters: False 59 | ``` 60 | 61 | ### -Passthru 62 | Whether to return closed Merge Request object to the pipeline. 63 | 64 | ```yaml 65 | Type: SwitchParameter 66 | Parameter Sets: (All) 67 | Aliases: 68 | 69 | Required: False 70 | Position: Named 71 | Default value: False 72 | Accept pipeline input: False 73 | Accept wildcard characters: False 74 | ``` 75 | 76 | ### CommonParameters 77 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 78 | 79 | ## INPUTS 80 | 81 | ## OUTPUTS 82 | 83 | ## NOTES 84 | 85 | ## RELATED LINKS 86 | -------------------------------------------------------------------------------- /docs/Close-GitLabMilestone.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Close-GitLabMilestone 9 | 10 | ## SYNOPSIS 11 | Closes your GitLab milestone. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Close-GitLabMilestone [-ProjectId] [-ID] [-Passthru] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Closes your GitLab milestone. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Close-GitLabMilestone -ProjectId 8 -Id 32 27 | ``` 28 | 29 | ## PARAMETERS 30 | 31 | ### -ProjectId 32 | The project ID. 33 | 34 | ```yaml 35 | Type: String 36 | Parameter Sets: (All) 37 | Aliases: project_id 38 | 39 | Required: True 40 | Position: 1 41 | Default value: None 42 | Accept pipeline input: True (ByPropertyName) 43 | Accept wildcard characters: False 44 | ``` 45 | 46 | ### -ID 47 | The ID of the milestone to be closed. 48 | 49 | ```yaml 50 | Type: String[] 51 | Parameter Sets: (All) 52 | Aliases: 53 | 54 | Required: True 55 | Position: 2 56 | Default value: None 57 | Accept pipeline input: True (ByPropertyName) 58 | Accept wildcard characters: False 59 | ``` 60 | 61 | ### -Passthru 62 | Return the closed milestone. 63 | 64 | ```yaml 65 | Type: SwitchParameter 66 | Parameter Sets: (All) 67 | Aliases: 68 | 69 | Required: False 70 | Position: Named 71 | Default value: False 72 | Accept pipeline input: False 73 | Accept wildcard characters: False 74 | ``` 75 | 76 | ### CommonParameters 77 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 78 | 79 | ## INPUTS 80 | 81 | ## OUTPUTS 82 | 83 | ## NOTES 84 | 85 | ## RELATED LINKS 86 | -------------------------------------------------------------------------------- /docs/Get-GItLabSetting.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-GitLabSetting 9 | 10 | ## SYNOPSIS 11 | Get all of the GitLab instance global settings. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-GitLabSetting [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Get all of the GitLab instance global settings. 21 | Uses the appliation API endpoint. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Get-GitLabSetting 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### CommonParameters 33 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 34 | 35 | ## INPUTS 36 | 37 | ## OUTPUTS 38 | 39 | ## NOTES 40 | 41 | ## RELATED LINKS 42 | -------------------------------------------------------------------------------- /docs/Get-GitLabIssue.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-GitLabIssue 9 | 10 | ## SYNOPSIS 11 | Get issues from the GitLab instance. 12 | 13 | ## SYNTAX 14 | 15 | ### User (Default) 16 | ``` 17 | Get-GitLabIssue [-Scope ] [-State ] [] 18 | ``` 19 | 20 | ### GroupID 21 | ``` 22 | Get-GitLabIssue [-GroupID ] [-Scope ] [-State ] [] 23 | ``` 24 | 25 | ## DESCRIPTION 26 | Get issues from the GitLab instance. 27 | 28 | ## EXAMPLES 29 | 30 | ### EXAMPLE 1 31 | ``` 32 | Get-GitLabIssue 33 | ``` 34 | 35 | Returns all issues created by the current user. 36 | 37 | ### EXAMPLE 2 38 | ``` 39 | Get-GitLabIssue -Scope all 40 | ``` 41 | 42 | Returns all issues the current user has access to. 43 | 44 | ### EXAMPLE 3 45 | ``` 46 | Get-GitLabIssue -State closed 47 | ``` 48 | 49 | Returns all issues created by the current user that are closed. 50 | 51 | ### EXAMPLE 4 52 | ``` 53 | Get-GitLabIssue -GroupID 2 54 | ``` 55 | 56 | Returns all issues in the group with an ID of 2. 57 | 58 | ### EXAMPLE 5 59 | ``` 60 | Get-GitLabIssue -GroupID 2 -Scope AssignedToMe 61 | ``` 62 | 63 | Returns all issues in the group with an ID of 2, that are assigned to me. 64 | 65 | ## PARAMETERS 66 | 67 | ### -GroupID 68 | A group ID. 69 | 70 | ```yaml 71 | Type: Int32 72 | Parameter Sets: GroupID 73 | Aliases: 74 | 75 | Required: False 76 | Position: Named 77 | Default value: None 78 | Accept pipeline input: False 79 | Accept wildcard characters: False 80 | ``` 81 | 82 | ### -Scope 83 | Scope for the request. All returns all issues the current user can access. CreatedByMe are issues created by the current user, and AssignedToMe are issues that have been assigned to the current user. 84 | 85 | ```yaml 86 | Type: String 87 | Parameter Sets: (All) 88 | Aliases: 89 | Accepted values: All, CreatedByMe, AssignedToMe 90 | 91 | Required: False 92 | Position: Named 93 | Default value: False 94 | Accept pipeline input: False 95 | Accept wildcard characters: False 96 | ``` 97 | 98 | ### -State 99 | Filter by issues that are closed or opened only. 100 | 101 | ```yaml 102 | Type: String 103 | Parameter Sets: (All) 104 | Aliases: 105 | Accepted values: opened, closed 106 | 107 | Required: False 108 | Position: Named 109 | Default value: None 110 | Accept pipeline input: False 111 | Accept wildcard characters: False 112 | ``` 113 | 114 | ### CommonParameters 115 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 116 | 117 | ## INPUTS 118 | 119 | ## OUTPUTS 120 | 121 | ### GitLab.Issue 122 | 123 | ## NOTES 124 | 125 | ## RELATED LINKS 126 | -------------------------------------------------------------------------------- /docs/Get-GitLabMergeRequest.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-GitLabMergeRequest 9 | 10 | ## SYNOPSIS 11 | Retrieves all of the different merge requests for a project in a GitLab instance. 12 | 13 | ## SYNTAX 14 | 15 | ### MergeRequests (Default) 16 | ``` 17 | Get-GitLabMergeRequest -ProjectId [-Iid ] [-State ] [-OrderBy ] 18 | [-Sort ] [] 19 | ``` 20 | 21 | ### Single 22 | ``` 23 | Get-GitLabMergeRequest -ProjectId -Id [] 24 | ``` 25 | 26 | ## DESCRIPTION 27 | Retrieves all of the different merge requests for a project in a GitLab instance. 28 | Queries over HTTP and returns GitLab.MergeRequest type. 29 | 30 | ## EXAMPLES 31 | 32 | ### EXAMPLE 1 33 | ``` 34 | Get-GitLabMergeRequest -ProjectId 1 35 | ``` 36 | 37 | ### EXAMPLE 1 38 | ``` 39 | Get-GitLabMergeRequest -ProjectId 1 -Id 20 40 | ``` 41 | 42 | ## PARAMETERS 43 | 44 | ### -ProjectId 45 | The ID of a project 46 | 47 | ```yaml 48 | Type: String 49 | Parameter Sets: (All) 50 | Aliases: 51 | 52 | Required: True 53 | Position: Named 54 | Default value: None 55 | Accept pipeline input: False 56 | Accept wildcard characters: False 57 | ``` 58 | 59 | ### -Id 60 | The ID of the merge request your retrieving. 61 | 62 | ```yaml 63 | Type: String 64 | Parameter Sets: Single 65 | Aliases: 66 | 67 | Required: True 68 | Position: Named 69 | Default value: None 70 | Accept pipeline input: False 71 | Accept wildcard characters: False 72 | ``` 73 | 74 | ### -Iid 75 | Return the request having the given iid. 76 | 77 | ```yaml 78 | Type: String 79 | Parameter Sets: MergeRequests 80 | Aliases: 81 | 82 | Required: False 83 | Position: Named 84 | Default value: None 85 | Accept pipeline input: False 86 | Accept wildcard characters: False 87 | ``` 88 | 89 | ### -State 90 | Return all requests or just those that are merged, opened or closed. 91 | 92 | ```yaml 93 | Type: String 94 | Parameter Sets: MergeRequests 95 | Aliases: 96 | 97 | Required: False 98 | Position: Named 99 | Default value: None 100 | Accept pipeline input: False 101 | Accept wildcard characters: False 102 | ``` 103 | 104 | ### -OrderBy 105 | Return requests ordered by created_at or updated_at fields. 106 | Default is created_at. 107 | 108 | ```yaml 109 | Type: String 110 | Parameter Sets: MergeRequests 111 | Aliases: 112 | 113 | Required: False 114 | Position: Named 115 | Default value: None 116 | Accept pipeline input: False 117 | Accept wildcard characters: False 118 | ``` 119 | 120 | ### -Sort 121 | Return requests sorted in asc or desc order. 122 | Default is desc. 123 | 124 | ```yaml 125 | Type: String 126 | Parameter Sets: MergeRequests 127 | Aliases: 128 | 129 | Required: False 130 | Position: Named 131 | Default value: None 132 | Accept pipeline input: False 133 | Accept wildcard characters: False 134 | ``` 135 | 136 | ### CommonParameters 137 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 138 | 139 | ## INPUTS 140 | 141 | ## OUTPUTS 142 | 143 | ### GitLab.MergeRequest 144 | 145 | ## NOTES 146 | 147 | ## RELATED LINKS 148 | -------------------------------------------------------------------------------- /docs/Get-GitLabMilestone.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-GitLabMilestone 9 | 10 | ## SYNOPSIS 11 | Retrieves all of the different milestones for a project in a GitLab instance. 12 | 13 | ## SYNTAX 14 | 15 | ### MergeRequests (Default) 16 | ``` 17 | Get-GitLabMilestone -ProjectId [-Iid ] [-State ] [] 18 | ``` 19 | 20 | ### Single 21 | ``` 22 | Get-GitLabMilestone -ProjectId -Id [] 23 | ``` 24 | 25 | ## DESCRIPTION 26 | Retrieves all of the different milestones for a project in a GitLab instance. 27 | Queries over HTTP and returns GitLab.MergeRequest type. 28 | 29 | ## EXAMPLES 30 | 31 | ### EXAMPLE 1 32 | ``` 33 | Get-GitLabMilestone -ProjectId 1 34 | ``` 35 | 36 | ### EXAMPLE 2 37 | ``` 38 | Get-GitLabMilestone -ProjectId 1 -Id 20 39 | ``` 40 | 41 | ## PARAMETERS 42 | 43 | ### -ProjectId 44 | The project ID. 45 | 46 | ```yaml 47 | Type: String 48 | Parameter Sets: (All) 49 | Aliases: 50 | 51 | Required: True 52 | Position: Named 53 | Default value: None 54 | Accept pipeline input: False 55 | Accept wildcard characters: False 56 | ``` 57 | 58 | ### -Id 59 | The ID of the milestone. 60 | 61 | ```yaml 62 | Type: String 63 | Parameter Sets: Single 64 | Aliases: 65 | 66 | Required: True 67 | Position: Named 68 | Default value: None 69 | Accept pipeline input: False 70 | Accept wildcard characters: False 71 | ``` 72 | 73 | ### -Iid 74 | The exacty milestone Id. 75 | 76 | ```yaml 77 | Type: String 78 | Parameter Sets: MergeRequests 79 | Aliases: 80 | 81 | Required: False 82 | Position: Named 83 | Default value: None 84 | Accept pipeline input: False 85 | Accept wildcard characters: False 86 | ``` 87 | 88 | ### -State 89 | Return only active or closed milestones. 90 | 91 | ```yaml 92 | Type: String 93 | Parameter Sets: MergeRequests 94 | Aliases: 95 | 96 | Required: False 97 | Position: Named 98 | Default value: None 99 | Accept pipeline input: False 100 | Accept wildcard characters: False 101 | ``` 102 | 103 | ### CommonParameters 104 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 105 | 106 | ## INPUTS 107 | 108 | ## OUTPUTS 109 | 110 | ### GitLab.Milestone 111 | 112 | ## NOTES 113 | 114 | ## RELATED LINKS 115 | -------------------------------------------------------------------------------- /docs/Get-GitLabNamespace.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-GitLabNamespace 9 | 10 | ## SYNOPSIS 11 | Retrieves all of the different namespaces in a GitLab instance. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-GitLabNamespace [[-search] ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Retrieves all of the different namespaces in a GitLab instance. 21 | Queries over HTTP and returns GitLab.Namespace type. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Get-GitLabNamespace 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -search 33 | Returns a list of namespaces the user is authorized to see based on the search criteria. 34 | 35 | ```yaml 36 | Type: String 37 | Parameter Sets: (All) 38 | Aliases: 39 | 40 | Required: False 41 | Position: 1 42 | Default value: None 43 | Accept pipeline input: False 44 | Accept wildcard characters: False 45 | ``` 46 | 47 | ### CommonParameters 48 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 49 | 50 | ## INPUTS 51 | 52 | ## OUTPUTS 53 | 54 | ### GitLab.Namespace 55 | 56 | ## NOTES 57 | 58 | ## RELATED LINKS 59 | -------------------------------------------------------------------------------- /docs/Get-GitLabProjectArchive.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-GitLabProjectArchive 9 | 10 | ## SYNOPSIS 11 | Download the archive of a project 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-GitLabProjectArchive [-ProjectID] [[-CommitID] ] [[-OutFile] ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Download the archive of a project 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Get-GitLabProjectZipArchive -ProjectID 1 -OutFile C:\test.zip 27 | ``` 28 | 29 | Get Zip archive for project 1 and save to test.zip 30 | 31 | ## PARAMETERS 32 | 33 | ### -ProjectID 34 | ProjectID. 35 | 36 | ```yaml 37 | Type: Int32 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: 1 43 | Default value: 0 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -CommitID 49 | CommitID. 50 | 51 | ```yaml 52 | Type: String 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: False 57 | Position: 2 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### -OutFile 64 | Outputfile path and name 65 | 66 | ```yaml 67 | Type: String 68 | Parameter Sets: (All) 69 | Aliases: 70 | 71 | Required: False 72 | Position: 3 73 | Default value: "$PWD\test.zip" 74 | Accept pipeline input: False 75 | Accept wildcard characters: False 76 | ``` 77 | 78 | ### CommonParameters 79 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 80 | 81 | ## INPUTS 82 | 83 | ## OUTPUTS 84 | 85 | ## NOTES 86 | 87 | ## RELATED LINKS 88 | -------------------------------------------------------------------------------- /docs/Get-GitLabProjectCommit.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-GitLabProjectCommit 9 | 10 | ## SYNOPSIS 11 | Get the Project Commits 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-GitLabProjectCommit [-Id ] [-Namespace ] [-Branch ] [-After ] 17 | [-Before ] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Get the Project Commits 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Get-GitLabProjectCommit -id 1 28 | ``` 29 | 30 | Gets the Commits on project id 1 31 | 32 | ## PARAMETERS 33 | 34 | ### -Id 35 | Project Id. 36 | 37 | ```yaml 38 | Type: String 39 | Parameter Sets: (All) 40 | Aliases: 41 | 42 | Required: False 43 | Position: Named 44 | Default value: None 45 | Accept pipeline input: False 46 | Accept wildcard characters: False 47 | ``` 48 | 49 | ### -Namespace 50 | Project Namespace. 51 | 52 | ```yaml 53 | Type: String 54 | Parameter Sets: (All) 55 | Aliases: 56 | 57 | Required: False 58 | Position: Named 59 | Default value: None 60 | Accept pipeline input: False 61 | Accept wildcard characters: False 62 | ``` 63 | 64 | ### -After 65 | {{Fill After Description}} 66 | 67 | ```yaml 68 | Type: DateTime 69 | Parameter Sets: (All) 70 | Aliases: 71 | 72 | Required: False 73 | Position: Named 74 | Default value: None 75 | Accept pipeline input: False 76 | Accept wildcard characters: False 77 | ``` 78 | 79 | ### -Before 80 | {{Fill Before Description}} 81 | 82 | ```yaml 83 | Type: DateTime 84 | Parameter Sets: (All) 85 | Aliases: 86 | 87 | Required: False 88 | Position: Named 89 | Default value: None 90 | Accept pipeline input: False 91 | Accept wildcard characters: False 92 | ``` 93 | 94 | ### -Branch 95 | {{Fill Branch Description}} 96 | 97 | ```yaml 98 | Type: String 99 | Parameter Sets: (All) 100 | Aliases: Tag 101 | 102 | Required: False 103 | Position: Named 104 | Default value: None 105 | Accept pipeline input: False 106 | Accept wildcard characters: False 107 | ``` 108 | 109 | ### CommonParameters 110 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 111 | 112 | ## INPUTS 113 | 114 | ## OUTPUTS 115 | 116 | ### GitLab.Project.Tag 117 | 118 | ## NOTES 119 | 120 | ## RELATED LINKS 121 | -------------------------------------------------------------------------------- /docs/Get-GitLabProjectEvent.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-GitLabProjectEvent 9 | 10 | ## SYNOPSIS 11 | Gets all of the project events. 12 | 13 | ## SYNTAX 14 | 15 | ### Id 16 | ``` 17 | Get-GitLabProjectEvent [-Id ] [] 18 | ``` 19 | 20 | ### Namespace 21 | ``` 22 | Get-GitLabProjectEvent [-Namespace ] [] 23 | ``` 24 | 25 | ## DESCRIPTION 26 | Gets all of the project events. 27 | This uses the v3 GitLab API. 28 | 29 | ## EXAMPLES 30 | 31 | ### EXAMPLE 1 32 | ``` 33 | Get-GitLabProjectEvent 34 | ``` 35 | 36 | title : 37 | project_id : 62 38 | action_name : pushed to 39 | target_id : 40 | target_type : 41 | author_id : 2 42 | 43 | ## PARAMETERS 44 | 45 | ### -Id 46 | The ID or NAMESPACE/PROJECT_NAME of the project. 47 | 48 | ```yaml 49 | Type: String 50 | Parameter Sets: Id 51 | Aliases: 52 | 53 | Required: False 54 | Position: Named 55 | Default value: None 56 | Accept pipeline input: False 57 | Accept wildcard characters: False 58 | ``` 59 | 60 | ### -Namespace 61 | The namespace of the project. 62 | 63 | ```yaml 64 | Type: String 65 | Parameter Sets: Namespace 66 | Aliases: 67 | 68 | Required: False 69 | Position: Named 70 | Default value: None 71 | Accept pipeline input: False 72 | Accept wildcard characters: False 73 | ``` 74 | 75 | ### CommonParameters 76 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 77 | 78 | ## INPUTS 79 | 80 | ## OUTPUTS 81 | 82 | ### GitLab.Project.Event 83 | 84 | ## NOTES 85 | 86 | ## RELATED LINKS 87 | -------------------------------------------------------------------------------- /docs/Get-GitLabProjectServiceMSTeams.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-GitLabProjectServiceMSTeams 9 | 10 | ## SYNOPSIS 11 | Get the Microsoft Teams Service from GitLab. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-GitLabProjectServiceMSTeams [-Id ] [-Namespace ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Get the Microsoft Teams Service from GitLab. The configurations can be found at Admin > Service Templates > Microsoft Teams Notification. 21 | 22 | ## EXAMPLES 23 | 24 | ### Example 1 25 | ``` 26 | PS C:\> Get-GitLabProjectServiceMSTeams -id 12 27 | ``` 28 | 29 | Get the MS Team configuration for the Project 12 30 | 31 | ## PARAMETERS 32 | 33 | ### -Id 34 | Project ID 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: False 42 | Position: Named 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -Namespace 49 | The name of the project. 50 | 51 | ```yaml 52 | Type: String 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: False 57 | Position: Named 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### CommonParameters 64 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 65 | 66 | ## INPUTS 67 | 68 | ### None 69 | 70 | ## OUTPUTS 71 | 72 | ### GitLab.Project.Service.MSTeams 73 | 74 | ## NOTES 75 | 76 | ## RELATED LINKS 77 | -------------------------------------------------------------------------------- /docs/Get-GitLabProjectServiceSlack.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: https://docs.gitlab.com/ce/api/services.html#get-slack-service-settings 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-GitLabProjectServiceSlack 9 | 10 | ## SYNOPSIS 11 | Get the Slack Webhook 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-GitLabProjectServiceSlack [-Id ] [-Namespace ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Gets Slack notification settings from gitlab 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Get-GitLabProjectServiceSlack -Webhook https://hooks.slack.com/asfdss -Id 1 27 | ``` 28 | 29 | Gets the Slack Settings on project id 1 30 | 31 | ## PARAMETERS 32 | 33 | ### -Id 34 | Project Id. 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: False 42 | Position: Named 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -Namespace 49 | Project Namespace. 50 | 51 | ```yaml 52 | Type: String 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: False 57 | Position: Named 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### CommonParameters 64 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 65 | 66 | ## INPUTS 67 | 68 | ## OUTPUTS 69 | 70 | ### GitLab.Project.Service.Slack 71 | 72 | ## NOTES 73 | 74 | ## RELATED LINKS 75 | 76 | [https://docs.gitlab.com/ce/api/services.html#get-slack-service-settings](https://docs.gitlab.com/ce/api/services.html#get-slack-service-settings) 77 | 78 | -------------------------------------------------------------------------------- /docs/Get-GitLabProjectTag.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-GitLabProjectTag 9 | 10 | ## SYNOPSIS 11 | Get the Project Tags 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-GitLabProjectTag [-Id ] [-Namespace ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Get the Project Tags 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Get-GitLabProjectTag -id 1 27 | ``` 28 | 29 | Gets the Tags on project id 1 30 | 31 | ## PARAMETERS 32 | 33 | ### -Id 34 | Project Id. 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: False 42 | Position: Named 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -Namespace 49 | Project Namespace. 50 | 51 | ```yaml 52 | Type: String 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: False 57 | Position: Named 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### CommonParameters 64 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 65 | 66 | ## INPUTS 67 | 68 | ## OUTPUTS 69 | 70 | ### GitLab.Project.Tag 71 | 72 | ## NOTES 73 | 74 | ## RELATED LINKS 75 | -------------------------------------------------------------------------------- /docs/Get-GitLabProjectWebhook.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: https://docs.gitlab.com/ce/api/projects.html#hooks 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-GitLabProjectWebhook 9 | 10 | ## SYNOPSIS 11 | Get the webhooks assigned to a project 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-GitLabProjectWebhook [-Id ] [-Namespace ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Get the web hooks assigned to aproject 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Get-GitLabProjectWebhook -Id 1 27 | ``` 28 | 29 | Get all thw webhooks for project id 1 30 | 31 | ### EXAMPLE 2 32 | ``` 33 | Get-GitLabProjectWebhook -Namespace Test 34 | ``` 35 | 36 | Get all thw webhooks for namespace Test 37 | 38 | ## PARAMETERS 39 | 40 | ### -Id 41 | Project Id. 42 | 43 | ```yaml 44 | Type: String 45 | Parameter Sets: (All) 46 | Aliases: 47 | 48 | Required: False 49 | Position: Named 50 | Default value: None 51 | Accept pipeline input: False 52 | Accept wildcard characters: False 53 | ``` 54 | 55 | ### -Namespace 56 | Project Namespace. 57 | 58 | ```yaml 59 | Type: String 60 | Parameter Sets: (All) 61 | Aliases: 62 | 63 | Required: False 64 | Position: Named 65 | Default value: None 66 | Accept pipeline input: False 67 | Accept wildcard characters: False 68 | ``` 69 | 70 | ### CommonParameters 71 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 72 | 73 | ## INPUTS 74 | 75 | ## OUTPUTS 76 | 77 | ### GitLab.Project.Webhook 78 | 79 | ## NOTES 80 | 81 | ## RELATED LINKS 82 | 83 | [https://docs.gitlab.com/ce/api/projects.html#hooks](https://docs.gitlab.com/ce/api/projects.html#hooks) 84 | 85 | -------------------------------------------------------------------------------- /docs/Get-GitLabRunner.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-GitLabRunner 9 | 10 | ## SYNOPSIS 11 | Retrieve all runner in a GitLab instance. 12 | 13 | ## SYNTAX 14 | 15 | ### Single (Default) 16 | ``` 17 | Get-GitLabRunner -Id [] 18 | ``` 19 | 20 | ### Project 21 | ``` 22 | Get-GitLabRunner -ProjectId [] 23 | ``` 24 | 25 | ### Owned 26 | ``` 27 | Get-GitLabRunner [-Owned] [-Scope ] [] 28 | ``` 29 | 30 | ### All 31 | ``` 32 | Get-GitLabRunner [-All] [-Scope ] [] 33 | ``` 34 | 35 | ## DESCRIPTION 36 | Retrieve all runners in a GitLab instance. 37 | Queries over HTTP and gets back GitLab.Project type. 38 | 39 | ## EXAMPLES 40 | 41 | ### EXAMPLE 1 42 | ``` 43 | Get-GitLabRunner -All 44 | ``` 45 | 46 | ### EXAMPLE 2 47 | ``` 48 | Get-GitLabRunner -Owned 49 | ``` 50 | 51 | ### EXAMPLE 3 52 | ``` 53 | Get-GitLabRunner -Id 4 54 | ``` 55 | 56 | ## PARAMETERS 57 | 58 | ### -Id 59 | The ID of the runner. 60 | 61 | ```yaml 62 | Type: Int32 63 | Parameter Sets: Single 64 | Aliases: 65 | 66 | Required: True 67 | Position: Named 68 | Default value: None 69 | Accept pipeline input: False 70 | Accept wildcard characters: False 71 | ``` 72 | 73 | ### -ProjectId 74 | The ID of the project for which to list all runners. 75 | 76 | ```yaml 77 | Type: Int32 78 | Parameter Sets: Project 79 | Aliases: 80 | 81 | Required: True 82 | Position: Named 83 | Default value: None 84 | Accept pipeline input: False 85 | Accept wildcard characters: False 86 | ``` 87 | 88 | ### -Owned 89 | Return all owned runners. 90 | 91 | ```yaml 92 | Type: SwitchParameter 93 | Parameter Sets: Owned 94 | Aliases: 95 | 96 | Required: True 97 | Position: Named 98 | Default value: None 99 | Accept pipeline input: False 100 | Accept wildcard characters: False 101 | ``` 102 | 103 | ### -All 104 | Return all available runners. 105 | 106 | ```yaml 107 | Type: SwitchParameter 108 | Parameter Sets: All 109 | Aliases: 110 | 111 | Required: True 112 | Position: Named 113 | Default value: None 114 | Accept pipeline input: False 115 | Accept wildcard characters: False 116 | ``` 117 | 118 | ### -Scope 119 | Limits the scope of runners to return. 120 | 121 | ```yaml 122 | Type: Object 123 | Parameter Sets: Owned, All 124 | Aliases: 125 | 126 | Required: False 127 | Position: Named 128 | Default value: None 129 | Accept pipeline input: False 130 | Accept wildcard characters: False 131 | ``` 132 | 133 | ### CommonParameters 134 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 135 | 136 | ## INPUTS 137 | 138 | ## OUTPUTS 139 | 140 | ### GitLab.Runner 141 | 142 | ## NOTES 143 | 144 | ## RELATED LINKS 145 | 146 | [Get runner details](https://docs.gitlab.com/ce/api/runners.html#get-runner-s-details) 147 | [List owned runners](https://docs.gitlab.com/ce/api/runners.html#list-owned-runners) 148 | [List all runners](https://docs.gitlab.com/ce/api/runners.html#list-all-runners) -------------------------------------------------------------------------------- /docs/Get-GitLabUser.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-GitLabUser 9 | 10 | ## SYNOPSIS 11 | Get users from the GitLab instance. 12 | 13 | ## SYNTAX 14 | 15 | ### All (Default) 16 | ``` 17 | Get-GitLabUser [-All] [] 18 | ``` 19 | 20 | ### ID 21 | ``` 22 | Get-GitLabUser [-ID ] [] 23 | ``` 24 | 25 | ### Username 26 | ``` 27 | Get-GitLabUser [-Username ] [] 28 | ``` 29 | 30 | ### Email 31 | ``` 32 | Get-GitLabUser [-Email ] [] 33 | ``` 34 | 35 | ### CurrentUser 36 | ``` 37 | Get-GitLabUser [-CurrentUser] [] 38 | ``` 39 | 40 | ## DESCRIPTION 41 | Get users from the GitLab instance. 42 | 43 | ## EXAMPLES 44 | 45 | ### EXAMPLE 1 46 | ``` 47 | Get-GitLabUser -ID 4 48 | ``` 49 | 50 | ### EXAMPLE 2 51 | ``` 52 | Get-GitLabUser -All 53 | ``` 54 | 55 | ### EXAMPLE 3 56 | ``` 57 | Get-GitLabUser -Username 'fakeuser' 58 | ``` 59 | 60 | ### EXAMPLE 4 61 | ``` 62 | Get-GitLabUser -Email 'fake@domain.com' 63 | ``` 64 | 65 | ## PARAMETERS 66 | 67 | ### -ID 68 | The user ID. 69 | 70 | ```yaml 71 | Type: String 72 | Parameter Sets: ID 73 | Aliases: 74 | 75 | Required: False 76 | Position: Named 77 | Default value: None 78 | Accept pipeline input: False 79 | Accept wildcard characters: False 80 | ``` 81 | 82 | ### -All 83 | Return back all users. 84 | 85 | ```yaml 86 | Type: SwitchParameter 87 | Parameter Sets: All 88 | Aliases: 89 | 90 | Required: False 91 | Position: Named 92 | Default value: False 93 | Accept pipeline input: False 94 | Accept wildcard characters: False 95 | ``` 96 | 97 | ### -Username 98 | Return user by username. 99 | 100 | ```yaml 101 | Type: String 102 | Parameter Sets: Username 103 | Aliases: 104 | 105 | Required: False 106 | Position: Named 107 | Default value: None 108 | Accept pipeline input: False 109 | Accept wildcard characters: False 110 | ``` 111 | 112 | ### -Email 113 | Return user by email. 114 | 115 | ```yaml 116 | Type: String 117 | Parameter Sets: Email 118 | Aliases: 119 | 120 | Required: False 121 | Position: Named 122 | Default value: None 123 | Accept pipeline input: False 124 | Accept wildcard characters: False 125 | ``` 126 | 127 | ### -CurrentUser 128 | Return back the current user. 129 | 130 | ```yaml 131 | Type: SwitchParameter 132 | Parameter Sets: CurrentUser 133 | Aliases: 134 | 135 | Required: False 136 | Position: Named 137 | Default value: False 138 | Accept pipeline input: False 139 | Accept wildcard characters: False 140 | ``` 141 | 142 | ### CommonParameters 143 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 144 | 145 | ## INPUTS 146 | 147 | ## OUTPUTS 148 | 149 | ### GitLab.User 150 | 151 | ## NOTES 152 | 153 | ## RELATED LINKS 154 | -------------------------------------------------------------------------------- /docs/Get-GitLabUserKey.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-GitLabUserKey 9 | 10 | ## SYNOPSIS 11 | Retrieves SSH keys from the current user. It can also get the keys of other users if run as admin. 12 | 13 | ## SYNTAX 14 | 15 | ### All (Default) 16 | ``` 17 | Get-GitLabUserKey [-All] [] 18 | ``` 19 | 20 | ### Key 21 | ``` 22 | Get-GitLabUserKey [-Key ] [] 23 | ``` 24 | 25 | ### Username 26 | ``` 27 | Get-GitLabUserKey [-Username ] [] 28 | ``` 29 | 30 | ### UserID 31 | ``` 32 | Get-GitLabUserKey [-UserId ] [] 33 | ``` 34 | 35 | ## DESCRIPTION 36 | Retrieves SSH keys from the current user. It can also get the keys of other users if run as admin. 37 | 38 | ## EXAMPLES 39 | 40 | ### Example 1 41 | ``` 42 | PS C:\> Get-GitLabUserKey 43 | ``` 44 | 45 | Get a list of currently authenticated user's SSH keys. 46 | 47 | ### Example 2 48 | ``` 49 | PS C:\> Get-GitLabUserKey -Key 1 50 | ``` 51 | 52 | Get one key. 53 | 54 | ### Example 3 55 | ``` 56 | PS C:\> Get-GitLabUserKey -Username root 57 | ``` 58 | 59 | Get all of the keys associated with the user root. 60 | 61 | ## PARAMETERS 62 | 63 | ### -All 64 | Get a list of currently authenticated user's SSH keys. 65 | 66 | ```yaml 67 | Type: SwitchParameter 68 | Parameter Sets: All 69 | Aliases: 70 | 71 | Required: False 72 | Position: Named 73 | Default value: None 74 | Accept pipeline input: False 75 | Accept wildcard characters: False 76 | ``` 77 | 78 | ### -Key 79 | Get the one key you're looking for. 80 | 81 | ```yaml 82 | Type: Int32 83 | Parameter Sets: Key 84 | Aliases: 85 | 86 | Required: False 87 | Position: Named 88 | Default value: None 89 | Accept pipeline input: False 90 | Accept wildcard characters: False 91 | ``` 92 | 93 | ### -UserId 94 | Get a list of a specified user's SSH keys. Available only for admin. 95 | 96 | ```yaml 97 | Type: Int32 98 | Parameter Sets: UserID 99 | Aliases: 100 | 101 | Required: False 102 | Position: Named 103 | Default value: None 104 | Accept pipeline input: False 105 | Accept wildcard characters: False 106 | ``` 107 | 108 | ### -Username 109 | Get a list of a specified user's SSH keys. Available only for admin. 110 | 111 | ```yaml 112 | Type: String 113 | Parameter Sets: Username 114 | Aliases: 115 | 116 | Required: False 117 | Position: Named 118 | Default value: None 119 | Accept pipeline input: False 120 | Accept wildcard characters: False 121 | ``` 122 | 123 | ### CommonParameters 124 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 125 | 126 | ## INPUTS 127 | 128 | ### None 129 | 130 | ## OUTPUTS 131 | 132 | ### GitLab.User.Key 133 | 134 | ## NOTES 135 | 136 | ## RELATED LINKS 137 | -------------------------------------------------------------------------------- /docs/Get-GitLabVersion.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-GitLabVersion 9 | 10 | ## SYNOPSIS 11 | Retrieves version information for this GitLab instance. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-GitLabVersion [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Retrieves version information for this GitLab instance. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Get-GitLabVersion 27 | ``` 28 | 29 | ## PARAMETERS 30 | 31 | ### CommonParameters 32 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 33 | 34 | ## INPUTS 35 | 36 | ## OUTPUTS 37 | 38 | ### GitLab.Version 39 | 40 | ## NOTES 41 | This feature was introduced in GitLab 8.13. 42 | 43 | ## RELATED LINKS 44 | 45 | [https://docs.gitlab.com/ce/api/version.html](https://docs.gitlab.com/ce/api/version.html) 46 | -------------------------------------------------------------------------------- /docs/Get-GitlabProjectRepositoryTree.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-GitlabProjectRepositoryTree 9 | 10 | ## SYNOPSIS 11 | Get the tree for a project 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-GitlabProjectRepositoryTree [-ProjectID] [[-CommitID] ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Reads the Repository tree from a Project 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Get-GitlabProjectRepositoryTree -ProjectID 1 27 | ``` 28 | 29 | GEt the Repository tree for project 1 30 | 31 | ## PARAMETERS 32 | 33 | ### -ProjectID 34 | ProjectID. 35 | 36 | ```yaml 37 | Type: Int32 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: 1 43 | Default value: 0 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -CommitID 49 | CommitID. 50 | 51 | ```yaml 52 | Type: String 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: False 57 | Position: 2 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### CommonParameters 64 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 65 | 66 | ## INPUTS 67 | 68 | ## OUTPUTS 69 | 70 | ## NOTES 71 | 72 | ## RELATED LINKS 73 | -------------------------------------------------------------------------------- /docs/Get-GitlabProjectSubmodule.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-GitlabProjectSubmodule 9 | 10 | ## SYNOPSIS 11 | Get the Submodules for a project 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-GitlabProjectSubmodule [-ProjectID] [[-CommitID] ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Reads the submodules files and outputs the data 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Get-GitlabProjectSubmodule -ProjectID 64 27 | ``` 28 | 29 | Get the submodules for project 64 30 | 31 | ## PARAMETERS 32 | 33 | ### -ProjectID 34 | Project ID. 35 | 36 | ```yaml 37 | Type: Int32 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: 1 43 | Default value: 0 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -CommitID 49 | Commit ID for the project 50 | 51 | ```yaml 52 | Type: String 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: False 57 | Position: 2 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### CommonParameters 64 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 65 | 66 | ## INPUTS 67 | 68 | ## OUTPUTS 69 | 70 | ## NOTES 71 | requires .gitmodules to exist in the root of the project 72 | 73 | ## RELATED LINKS 74 | -------------------------------------------------------------------------------- /docs/New-GitLabBuild.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-GitLabBuild 9 | 10 | ## SYNOPSIS 11 | Triggers a build 12 | 13 | ## SYNTAX 14 | 15 | ### Variable 16 | ``` 17 | New-GitLabBuild -ProjectId -Reference -token -Variable -Value 18 | [] 19 | ``` 20 | 21 | ### Default 22 | ``` 23 | New-GitLabBuild -ProjectId -Reference -token [] 24 | ``` 25 | 26 | ## DESCRIPTION 27 | Triggers a build 28 | 29 | ## EXAMPLES 30 | 31 | ### EXAMPLE 1 32 | ``` 33 | New-GitLabBuild -Id 18 -Reference 'master' -Variable "GENERATE_SCRIPTS" -Value "true" 34 | ``` 35 | 36 | id variables 37 | -- --------- 38 | 6 @{GENERATE_SCRIPTS=true} 39 | 40 | ## PARAMETERS 41 | 42 | ### -ProjectId 43 | The ID of a project 44 | 45 | ```yaml 46 | Type: Int32 47 | Parameter Sets: (All) 48 | Aliases: 49 | 50 | Required: True 51 | Position: Named 52 | Default value: 0 53 | Accept pipeline input: False 54 | Accept wildcard characters: False 55 | ``` 56 | 57 | ### -Reference 58 | Which branch branch to run the build against. 59 | 60 | ```yaml 61 | Type: String 62 | Parameter Sets: (All) 63 | Aliases: 64 | 65 | Required: True 66 | Position: Named 67 | Default value: None 68 | Accept pipeline input: False 69 | Accept wildcard characters: False 70 | ``` 71 | 72 | ### -token 73 | The user token. 74 | 75 | ```yaml 76 | Type: String 77 | Parameter Sets: (All) 78 | Aliases: 79 | 80 | Required: True 81 | Position: Named 82 | Default value: None 83 | Accept pipeline input: False 84 | Accept wildcard characters: False 85 | ``` 86 | 87 | ### -Variable 88 | The build variable for this build. 89 | 90 | ```yaml 91 | Type: String 92 | Parameter Sets: Variable 93 | Aliases: 94 | 95 | Required: True 96 | Position: Named 97 | Default value: None 98 | Accept pipeline input: False 99 | Accept wildcard characters: False 100 | ``` 101 | 102 | ### -Value 103 | The value of the build variable. 104 | 105 | ```yaml 106 | Type: String 107 | Parameter Sets: Variable 108 | Aliases: 109 | 110 | Required: True 111 | Position: Named 112 | Default value: None 113 | Accept pipeline input: False 114 | Accept wildcard characters: False 115 | ``` 116 | 117 | ### CommonParameters 118 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 119 | 120 | ## INPUTS 121 | 122 | ## OUTPUTS 123 | 124 | ## NOTES 125 | 126 | ## RELATED LINKS 127 | -------------------------------------------------------------------------------- /docs/New-GitLabFork.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-GitLabFork 9 | 10 | ## SYNOPSIS 11 | Creates a new fork from a project. 12 | Uses the user namespace. 13 | 14 | ## SYNTAX 15 | 16 | ``` 17 | New-GitLabFork [-Id ] [-Namespace ] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Creates a new fork from a project. 22 | Uses the user namespace. 23 | This uses the v3 GitLab API. 24 | 25 | ## EXAMPLES 26 | 27 | ### EXAMPLE 1 28 | ``` 29 | New-GitLabFork -Id 39 30 | ``` 31 | 32 | id : 99 33 | name : Chef 34 | name_with_namespace : ngetchell / Chef 35 | web_url : http://example.com/HomeLab/Chef 36 | created_at : 2016-02-01T23:55:26.696Z 37 | last_activity_at : 2016-04-24T18:42:58.529Z 38 | 39 | ## PARAMETERS 40 | 41 | ### -Id 42 | The ID or NAMESPACE/PROJECT_NAME of the project. 43 | 44 | ```yaml 45 | Type: String 46 | Parameter Sets: (All) 47 | Aliases: 48 | 49 | Required: False 50 | Position: Named 51 | Default value: None 52 | Accept pipeline input: False 53 | Accept wildcard characters: False 54 | ``` 55 | 56 | ### -Namespace 57 | The namespace of the project. 58 | 59 | ```yaml 60 | Type: String 61 | Parameter Sets: (All) 62 | Aliases: 63 | 64 | Required: False 65 | Position: Named 66 | Default value: None 67 | Accept pipeline input: False 68 | Accept wildcard characters: False 69 | ``` 70 | 71 | ### CommonParameters 72 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 73 | 74 | ## INPUTS 75 | 76 | ## OUTPUTS 77 | 78 | ## NOTES 79 | 80 | ## RELATED LINKS 81 | -------------------------------------------------------------------------------- /docs/New-GitLabGroup.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-GitLabGroup 9 | 10 | ## SYNOPSIS 11 | Creates a new GitLab group. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-GitLabGroup [-Name] [-Path] [[-Description] ] [[-Visibility] ] 17 | [[-Parent_Id] ] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Creates a new GitLab group. 22 | 23 | ## EXAMPLES 24 | 25 | ### -------------------------- EXAMPLE 1 -------------------------- 26 | ```powershell 27 | PS C:\> New-GitLabGroup -Name 'TestGroup1' -Path 'TestGroup1' -Description 'This is a description.' 28 | ``` 29 | 30 | ### -------------------------- EXAMPLE 2 -------------------------- 31 | ```powershell 32 | PS C:\> New-GitLabGroup -Name 'TestGroup2' -Path 'ITDept-TestGroup2' -Description 'This is a description.' 33 | ``` 34 | 35 | ### -------------------------- EXAMPLE 3 -------------------------- 36 | ```powershell 37 | PS C:\> New-GitLabGroup -Name 'testGroup6' -Path 'nestedgroup' -Description 'something' -Parent_Id 34 38 | ``` 39 | 40 | ## PARAMETERS 41 | 42 | ### -Description 43 | A description for the group. 44 | 45 | ```yaml 46 | Type: Object 47 | Parameter Sets: (All) 48 | Aliases: 49 | 50 | Required: False 51 | Position: 2 52 | Default value: None 53 | Accept pipeline input: False 54 | Accept wildcard characters: False 55 | ``` 56 | 57 | ### -Name 58 | The name of the group. 59 | 60 | ```yaml 61 | Type: Object 62 | Parameter Sets: (All) 63 | Aliases: 64 | 65 | Required: True 66 | Position: 0 67 | Default value: None 68 | Accept pipeline input: False 69 | Accept wildcard characters: False 70 | ``` 71 | 72 | ### -Parent_Id 73 | The ID for the parent group (if specified this will create a subgroup). 74 | 75 | ```yaml 76 | Type: Object 77 | Parameter Sets: (All) 78 | Aliases: 79 | 80 | Required: False 81 | Position: 4 82 | Default value: None 83 | Accept pipeline input: False 84 | Accept wildcard characters: False 85 | ``` 86 | 87 | ### -Path 88 | The path you wish the group to exist at. 89 | 90 | ```yaml 91 | Type: Object 92 | Parameter Sets: (All) 93 | Aliases: 94 | 95 | Required: True 96 | Position: 1 97 | Default value: None 98 | Accept pipeline input: False 99 | Accept wildcard characters: False 100 | ``` 101 | 102 | ### -Visibility 103 | Visibility of the group. Defaults to private. 104 | 105 | ```yaml 106 | Type: Object 107 | Parameter Sets: (All) 108 | Aliases: 109 | Accepted values: public, internal, private 110 | 111 | Required: False 112 | Position: 3 113 | Default value: None 114 | Accept pipeline input: False 115 | Accept wildcard characters: False 116 | ``` 117 | 118 | ### CommonParameters 119 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. 120 | For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 121 | 122 | ## INPUTS 123 | 124 | ### None 125 | 126 | ## OUTPUTS 127 | 128 | ### GitLab.Group 129 | 130 | ## NOTES 131 | 132 | ## RELATED LINKS 133 | -------------------------------------------------------------------------------- /docs/New-GitLabMilestone.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-GitLabMilestone 9 | 10 | ## SYNOPSIS 11 | Creates a new milestone. 12 | Uses the user namespace. 13 | 14 | ## SYNTAX 15 | 16 | ``` 17 | New-GitLabMilestone [-ProjectId] [-Title] [[-Description] ] [[-DueDate] ] 18 | [] 19 | ``` 20 | 21 | ## DESCRIPTION 22 | Creates a new milestone. 23 | Uses the user namespace. 24 | This uses the v3 GitLab API. 25 | 26 | ## EXAMPLES 27 | 28 | ### EXAMPLE 1 29 | ``` 30 | New-GitLabMilestone -ProjectId 8 -Title "2016-KW30" -Description "MyDescription" -DueDate (Get-Date).AddDays(10) 31 | ``` 32 | 33 | ## PARAMETERS 34 | 35 | ### -ProjectId 36 | The ID of a project. 37 | 38 | ```yaml 39 | Type: String 40 | Parameter Sets: (All) 41 | Aliases: 42 | 43 | Required: True 44 | Position: 1 45 | Default value: None 46 | Accept pipeline input: False 47 | Accept wildcard characters: False 48 | ``` 49 | 50 | ### -Title 51 | The title of an milestone. 52 | 53 | ```yaml 54 | Type: String 55 | Parameter Sets: (All) 56 | Aliases: 57 | 58 | Required: True 59 | Position: 2 60 | Default value: None 61 | Accept pipeline input: False 62 | Accept wildcard characters: False 63 | ``` 64 | 65 | ### -Description 66 | The description of an milestone 67 | 68 | ```yaml 69 | Type: String 70 | Parameter Sets: (All) 71 | Aliases: 72 | 73 | Required: False 74 | Position: 3 75 | Default value: None 76 | Accept pipeline input: False 77 | Accept wildcard characters: False 78 | ``` 79 | 80 | ### -DueDate 81 | The due date of the milestone. 82 | 83 | ```yaml 84 | Type: DateTime 85 | Parameter Sets: (All) 86 | Aliases: 87 | 88 | Required: False 89 | Position: 4 90 | Default value: None 91 | Accept pipeline input: False 92 | Accept wildcard characters: False 93 | ``` 94 | 95 | ### CommonParameters 96 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 97 | 98 | ## INPUTS 99 | 100 | ## OUTPUTS 101 | 102 | ## NOTES 103 | 104 | ## RELATED LINKS 105 | -------------------------------------------------------------------------------- /docs/New-GitLabUserKey.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: https://docs.gitlab.com/ce/api/projects.html#hooks 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-GitLabUserKey 9 | 10 | ## SYNOPSIS 11 | Creates new SSH Key for the current or another user. 12 | 13 | ## SYNTAX 14 | 15 | ### Explicit (Default) 16 | ``` 17 | New-GitLabUserKey [-Title ] -Key [-Username ] [] 18 | ``` 19 | 20 | ### File 21 | ``` 22 | New-GitLabUserKey -KeyFile [-Username ] [] 23 | ``` 24 | 25 | ## DESCRIPTION 26 | Creates new SSH Key for the current or another user. 27 | For another user, admin rights are required. 28 | 29 | ## EXAMPLES 30 | 31 | ### Example 1 32 | ``` 33 | PS C:\> New-GitLabUserKey -Title "Fake" -Key "ssh-rsa lkasjflkjasdf...." 34 | ``` 35 | 36 | Create a new key from the command prompt. 37 | 38 | ### Example 2 39 | ``` 40 | PS C:\> New-GitLabUserKey -KeyFile ~/.ssh/id_rsa.pub 41 | ``` 42 | 43 | Add a key from a keyfile. 44 | 45 | ## PARAMETERS 46 | 47 | ### -Key 48 | A string representation of the SSH key. 49 | 50 | ```yaml 51 | Type: String 52 | Parameter Sets: Explicit 53 | Aliases: 54 | 55 | Required: True 56 | Position: Named 57 | Default value: None 58 | Accept pipeline input: False 59 | Accept wildcard characters: False 60 | ``` 61 | 62 | ### -KeyFile 63 | The public key you wish to upload. 64 | 65 | ```yaml 66 | Type: String 67 | Parameter Sets: File 68 | Aliases: 69 | 70 | Required: True 71 | Position: Named 72 | Default value: None 73 | Accept pipeline input: False 74 | Accept wildcard characters: False 75 | ``` 76 | 77 | ### -Title 78 | The title of the SSH key. 79 | 80 | ```yaml 81 | Type: String 82 | Parameter Sets: Explicit 83 | Aliases: 84 | 85 | Required: False 86 | Position: Named 87 | Default value: None 88 | Accept pipeline input: False 89 | Accept wildcard characters: False 90 | ``` 91 | 92 | ### -Username 93 | The username of the user you would like to add the SSH key for. 94 | 95 | ```yaml 96 | Type: Object 97 | Parameter Sets: (All) 98 | Aliases: 99 | 100 | Required: False 101 | Position: Named 102 | Default value: None 103 | Accept pipeline input: False 104 | Accept wildcard characters: False 105 | ``` 106 | 107 | ### CommonParameters 108 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 109 | 110 | ## INPUTS 111 | 112 | ### None 113 | 114 | ## OUTPUTS 115 | 116 | ### GitLab.User.Key 117 | 118 | ## NOTES 119 | 120 | ## RELATED LINKS 121 | -------------------------------------------------------------------------------- /docs/Push-SSHKeysToGitLab.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Push-SSHKeysToGitLab 9 | 10 | ## SYNOPSIS 11 | Push all of your public keys to GitLab. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Push-SSHKeysToGitLab [[-SSHDirectory] ] [-WhatIf] [-Confirm] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Push all of your public keys to GitLab. Confirmation level of High. 21 | 22 | ## EXAMPLES 23 | 24 | ### Example 1 25 | ``` 26 | PS C:\> Push-SSHKeysToGitLab 27 | ``` 28 | 29 | Push all keys located in ~/.ssh to your GitLab instance. 30 | 31 | ### Example 2 32 | ``` 33 | PS C:\> Push-SSHKeysToGitLab -SSHDirectory "c:\ssh\" 34 | ``` 35 | 36 | Overwrite the default directory and push to GitLab instance. 37 | 38 | ## PARAMETERS 39 | 40 | ### -Confirm 41 | Prompts you for confirmation before running the cmdlet. 42 | 43 | ```yaml 44 | Type: SwitchParameter 45 | Parameter Sets: (All) 46 | Aliases: cf 47 | 48 | Required: False 49 | Position: Named 50 | Default value: None 51 | Accept pipeline input: False 52 | Accept wildcard characters: False 53 | ``` 54 | 55 | ### -SSHDirectory 56 | A folder with SSH public keys. 57 | 58 | ```yaml 59 | Type: Object 60 | Parameter Sets: (All) 61 | Aliases: 62 | 63 | Required: False 64 | Position: 0 65 | Default value: None 66 | Accept pipeline input: False 67 | Accept wildcard characters: False 68 | ``` 69 | 70 | ### -WhatIf 71 | Shows what would happen if the cmdlet runs. 72 | The cmdlet is not run. 73 | 74 | ```yaml 75 | Type: SwitchParameter 76 | Parameter Sets: (All) 77 | Aliases: wi 78 | 79 | Required: False 80 | Position: Named 81 | Default value: None 82 | Accept pipeline input: False 83 | Accept wildcard characters: False 84 | ``` 85 | 86 | ### CommonParameters 87 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 88 | 89 | ## INPUTS 90 | 91 | ### None 92 | 93 | ## OUTPUTS 94 | 95 | ### System.Object 96 | 97 | ## NOTES 98 | 99 | ## RELATED LINKS 100 | -------------------------------------------------------------------------------- /docs/Remove-GitLabMergeRequest.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-GitLabMergeRequest 9 | 10 | ## SYNOPSIS 11 | Deletes a GitLab merge request from project. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-GitLabMergeRequest [-ProjectId] [-Id] [-WhatIf] [-Confirm] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Deletes a GitLab merge request from project. 21 | Can only be done by ID. 22 | Supports should process. 23 | 24 | ## EXAMPLES 25 | 26 | ### EXAMPLE 1 27 | ``` 28 | Remove-GitLabMergeRequest -ProjectId 8 -Id 99 29 | ``` 30 | 31 | ## PARAMETERS 32 | 33 | ### -ProjectId 34 | The project ID. 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: project_id 40 | 41 | Required: True 42 | Position: 1 43 | Default value: None 44 | Accept pipeline input: True (ByPropertyName) 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -Id 49 | The id of the merge request. 50 | 51 | ```yaml 52 | Type: String 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: True 57 | Position: 2 58 | Default value: None 59 | Accept pipeline input: True (ByPropertyName) 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### -WhatIf 64 | Run without making modifications. 65 | 66 | ```yaml 67 | Type: SwitchParameter 68 | Parameter Sets: (All) 69 | Aliases: wi 70 | 71 | Required: False 72 | Position: Named 73 | Default value: None 74 | Accept pipeline input: False 75 | Accept wildcard characters: False 76 | ``` 77 | 78 | ### -Confirm 79 | Whether to continue or not. 80 | 81 | ```yaml 82 | Type: SwitchParameter 83 | Parameter Sets: (All) 84 | Aliases: cf 85 | 86 | Required: False 87 | Position: Named 88 | Default value: None 89 | Accept pipeline input: False 90 | Accept wildcard characters: False 91 | ``` 92 | 93 | ### CommonParameters 94 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 95 | 96 | ## INPUTS 97 | 98 | ## OUTPUTS 99 | 100 | ## NOTES 101 | 102 | ## RELATED LINKS 103 | -------------------------------------------------------------------------------- /docs/Remove-GitLabProject.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-GitLabProject 9 | 10 | ## SYNOPSIS 11 | Deletes a GitLab project. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-GitLabProject [-Id] [-WhatIf] [-Confirm] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Deletes a GitLab project. 21 | Can only be done by ID. 22 | Supports should process. 23 | 24 | ## EXAMPLES 25 | 26 | ### EXAMPLE 1 27 | ``` 28 | Remove-GitLabProject -Id 99 29 | ``` 30 | 31 | ## PARAMETERS 32 | 33 | ### -Id 34 | The project Id. 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: 1 43 | Default value: None 44 | Accept pipeline input: True (ByPropertyName) 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -WhatIf 49 | Run without making modifications. 50 | 51 | ```yaml 52 | Type: SwitchParameter 53 | Parameter Sets: (All) 54 | Aliases: wi 55 | 56 | Required: False 57 | Position: Named 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### -Confirm 64 | Whether to continue or not. 65 | 66 | ```yaml 67 | Type: SwitchParameter 68 | Parameter Sets: (All) 69 | Aliases: cf 70 | 71 | Required: False 72 | Position: Named 73 | Default value: None 74 | Accept pipeline input: False 75 | Accept wildcard characters: False 76 | ``` 77 | 78 | ### CommonParameters 79 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 80 | 81 | ## INPUTS 82 | 83 | ## OUTPUTS 84 | 85 | ## NOTES 86 | 87 | ## RELATED LINKS 88 | -------------------------------------------------------------------------------- /docs/Remove-GitLabProjectRunner.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-GitLabProjectRunner 9 | 10 | ## SYNOPSIS 11 | Disable a specific runner from the project. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-GitLabProjectRunner -RunnerId -ProjectId [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Disable a specific runner from the project. 21 | Works only if the project isn't the only project associated with the specified runner. 22 | If so, an error is returned. Use the Remove-GitLabRunner instead. 23 | 24 | ## EXAMPLES 25 | 26 | ### EXAMPLE 1 27 | ``` 28 | Remove-GitLabProjectRunner -RunnerId 400 -ProjectId 500 29 | ``` 30 | 31 | ## PARAMETERS 32 | 33 | ### -RunnerId 34 | The ID of the GitLab runner to disable on the project. 35 | 36 | ```yaml 37 | Type: Int32 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: Named 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -ProjectId 49 | The ID of the project on which to disable the runner. 50 | 51 | ```yaml 52 | Type: Int32 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: True 57 | Position: Named 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### CommonParameters 64 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 65 | 66 | ## INPUTS 67 | 68 | ## OUTPUTS 69 | 70 | ## NOTES 71 | 72 | ## RELATED LINKS 73 | 74 | [Disable a runner in a project](https://docs.gitlab.com/ce/api/runners.html#disable-a-runner-from-project) -------------------------------------------------------------------------------- /docs/Remove-GitLabProjectServiceMSTeams.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-GitLabProjectServiceMSTeams 9 | 10 | ## SYNOPSIS 11 | Get rid of the service. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-GitLabProjectServiceMSTeams [-Id ] [-Namespace ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Get rid of the service. The configurations can be found at Admin > Service Templates > Microsoft Teams Notification. 21 | 22 | ## EXAMPLES 23 | 24 | ### Example 1 25 | ``` 26 | PS C:\> Remove-GitLabProjectServiceMSTeams -Id 12 27 | ``` 28 | 29 | Removes the service from project 12. 30 | 31 | ## PARAMETERS 32 | 33 | ### -Id 34 | ProjectID 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: False 42 | Position: Named 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -Namespace 49 | The name of the project in namespace format. 50 | 51 | ```yaml 52 | Type: String 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: False 57 | Position: Named 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### CommonParameters 64 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 65 | 66 | ## INPUTS 67 | 68 | ### None 69 | 70 | ## OUTPUTS 71 | 72 | ### GitLab.Project.Service.MSTeams 73 | 74 | ## NOTES 75 | 76 | ## RELATED LINKS 77 | -------------------------------------------------------------------------------- /docs/Remove-GitLabProjectServiceSlack.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: https://docs.gitlab.com/ce/api/services.html#get-slack-service-settings 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-GitLabProjectServiceSlack 9 | 10 | ## SYNOPSIS 11 | Remove Slack Webhook 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-GitLabProjectServiceSlack [-Id ] [-Namespace ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Disables Slack notification from gitlab 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Remove-GitLabProjectServiceSlack -Id 1 27 | ``` 28 | 29 | Disables Slack Notification on project id 1 30 | 31 | ## PARAMETERS 32 | 33 | ### -Id 34 | Project Id. 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: False 42 | Position: Named 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -Namespace 49 | Project Namespace. 50 | 51 | ```yaml 52 | Type: String 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: False 57 | Position: Named 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### CommonParameters 64 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 65 | 66 | ## INPUTS 67 | 68 | ## OUTPUTS 69 | 70 | ### GitLab.Project.Service.Slack 71 | 72 | ## NOTES 73 | 74 | ## RELATED LINKS 75 | 76 | [https://docs.gitlab.com/ce/api/services.html#get-slack-service-settings](https://docs.gitlab.com/ce/api/services.html#get-slack-service-settings) 77 | 78 | -------------------------------------------------------------------------------- /docs/Remove-GitLabProjectWebhook.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: https://docs.gitlab.com/ce/api/projects.html#hooks 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-GitLabProjectWebhook 9 | 10 | ## SYNOPSIS 11 | Remove a webhook assigned to a project 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-GitLabProjectWebhook [-Id ] [-Namespace ] -hook_id [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Remove a webhook assigned to a project 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Remove-GitLabProjectWebhooks -Id 1 -hook_id 1 27 | ``` 28 | 29 | Remove webhook ID 1 for project id 1 30 | 31 | ### EXAMPLE 2 32 | ``` 33 | Remove-GitLabProjectWebhooks -Namespace Test -hook_id 1 34 | ``` 35 | 36 | Remove webhook ID 1 for namespace Test 37 | 38 | ## PARAMETERS 39 | 40 | ### -Id 41 | Project Id. 42 | 43 | ```yaml 44 | Type: String 45 | Parameter Sets: (All) 46 | Aliases: 47 | 48 | Required: False 49 | Position: Named 50 | Default value: None 51 | Accept pipeline input: False 52 | Accept wildcard characters: False 53 | ``` 54 | 55 | ### -Namespace 56 | Project Namespace. 57 | 58 | ```yaml 59 | Type: String 60 | Parameter Sets: (All) 61 | Aliases: 62 | 63 | Required: False 64 | Position: Named 65 | Default value: None 66 | Accept pipeline input: False 67 | Accept wildcard characters: False 68 | ``` 69 | 70 | ### -hook_id 71 | Webhook ID 72 | 73 | ```yaml 74 | Type: String 75 | Parameter Sets: (All) 76 | Aliases: 77 | 78 | Required: True 79 | Position: Named 80 | Default value: None 81 | Accept pipeline input: False 82 | Accept wildcard characters: False 83 | ``` 84 | 85 | ### CommonParameters 86 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 87 | 88 | ## INPUTS 89 | 90 | ## OUTPUTS 91 | 92 | ### GitLab.Project.Webhook 93 | 94 | ## NOTES 95 | 96 | ## RELATED LINKS 97 | 98 | [https://docs.gitlab.com/ce/api/projects.html#hooks](https://docs.gitlab.com/ce/api/projects.html#hooks) 99 | 100 | -------------------------------------------------------------------------------- /docs/Remove-GitLabRunner.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-GitLabRunner 9 | 10 | ## SYNOPSIS 11 | Removes a runner. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-GitLabRunner -Id [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Removes a runner from GitLab. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Remove-GitLabRunner -Id 400 27 | ``` 28 | 29 | ## PARAMETERS 30 | 31 | ### -Id 32 | The ID of the GitLab runner to remove. 33 | 34 | ```yaml 35 | Type: Int32 36 | Parameter Sets: (All) 37 | Aliases: 38 | 39 | Required: True 40 | Position: Named 41 | Default value: None 42 | Accept pipeline input: False 43 | Accept wildcard characters: False 44 | ``` 45 | 46 | ### CommonParameters 47 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 48 | 49 | ## INPUTS 50 | 51 | ## OUTPUTS 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | 57 | [Remove a runner](https://docs.gitlab.com/ce/api/runners.html#remove-a-runner) -------------------------------------------------------------------------------- /docs/Remove-GitLabUser.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-GitLabUser 9 | 10 | ## SYNOPSIS 11 | User to get rid of users. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-GitLabUser [-Username] [-WhatIf] [-Confirm] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Used to get rid of users. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Search-GitLabUser -User 'fake' | Remove-GitLabUser 27 | ``` 28 | 29 | ## PARAMETERS 30 | 31 | ### -Username 32 | The username of the user being removed. 33 | 34 | ```yaml 35 | Type: String[] 36 | Parameter Sets: (All) 37 | Aliases: 38 | 39 | Required: True 40 | Position: 1 41 | Default value: None 42 | Accept pipeline input: True (ByPropertyName) 43 | Accept wildcard characters: False 44 | ``` 45 | 46 | ### -WhatIf 47 | Run without making modifications. 48 | 49 | ```yaml 50 | Type: SwitchParameter 51 | Parameter Sets: (All) 52 | Aliases: wi 53 | 54 | Required: False 55 | Position: Named 56 | Default value: None 57 | Accept pipeline input: False 58 | Accept wildcard characters: False 59 | ``` 60 | 61 | ### -Confirm 62 | Whether to continue or not. 63 | 64 | ```yaml 65 | Type: SwitchParameter 66 | Parameter Sets: (All) 67 | Aliases: cf 68 | 69 | Required: False 70 | Position: Named 71 | Default value: None 72 | Accept pipeline input: False 73 | Accept wildcard characters: False 74 | ``` 75 | 76 | ### CommonParameters 77 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 78 | 79 | ## INPUTS 80 | 81 | ## OUTPUTS 82 | 83 | ## NOTES 84 | 85 | ## RELATED LINKS 86 | -------------------------------------------------------------------------------- /docs/Remove-GitLabUserKey.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-GitLabUserKey 9 | 10 | ## SYNOPSIS 11 | Gets rid of an SSH key for the current user or another user. 12 | 13 | ## SYNTAX 14 | 15 | ### User 16 | ``` 17 | Remove-GitLabUserKey -Id -Username [-Passthru] [-WhatIf] [-Confirm] [] 18 | ``` 19 | 20 | ### Id 21 | ``` 22 | Remove-GitLabUserKey -Id [-Passthru] [-WhatIf] [-Confirm] [] 23 | ``` 24 | 25 | ## DESCRIPTION 26 | Gets rid of an SSH key for the current user or another user. For another user you must have admin rights. 27 | 28 | ## EXAMPLES 29 | 30 | ### Example 1 31 | ``` 32 | PS C:\> Remove-GitLabUserKey -Id 2 33 | ``` 34 | 35 | Removes the second user key. 36 | 37 | ### Example 1 38 | ``` 39 | PS C:\> Remove-GitLabUserKey -Id 2 -User root 40 | ``` 41 | 42 | Removes the second user key that belongs to root. 43 | 44 | ## PARAMETERS 45 | 46 | ### -Confirm 47 | Prompts you for confirmation before running the cmdlet. 48 | 49 | ```yaml 50 | Type: SwitchParameter 51 | Parameter Sets: (All) 52 | Aliases: cf 53 | 54 | Required: False 55 | Position: Named 56 | Default value: None 57 | Accept pipeline input: False 58 | Accept wildcard characters: False 59 | ``` 60 | 61 | ### -Id 62 | The id of the key. 63 | 64 | ```yaml 65 | Type: String 66 | Parameter Sets: (All) 67 | Aliases: 68 | 69 | Required: True 70 | Position: Named 71 | Default value: None 72 | Accept pipeline input: False 73 | Accept wildcard characters: False 74 | ``` 75 | 76 | ### -Passthru 77 | Whether to return the key information or not. 78 | 79 | ```yaml 80 | Type: SwitchParameter 81 | Parameter Sets: (All) 82 | Aliases: 83 | 84 | Required: False 85 | Position: Named 86 | Default value: None 87 | Accept pipeline input: False 88 | Accept wildcard characters: False 89 | ``` 90 | 91 | ### -Username 92 | The username you would like to delete the key for. 93 | 94 | ```yaml 95 | Type: String 96 | Parameter Sets: User 97 | Aliases: 98 | 99 | Required: True 100 | Position: Named 101 | Default value: None 102 | Accept pipeline input: False 103 | Accept wildcard characters: False 104 | ``` 105 | 106 | ### -WhatIf 107 | Shows what would happen if the cmdlet runs. 108 | The cmdlet is not run. 109 | 110 | ```yaml 111 | Type: SwitchParameter 112 | Parameter Sets: (All) 113 | Aliases: wi 114 | 115 | Required: False 116 | Position: Named 117 | Default value: None 118 | Accept pipeline input: False 119 | Accept wildcard characters: False 120 | ``` 121 | 122 | ### CommonParameters 123 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 124 | 125 | ## INPUTS 126 | 127 | ### None 128 | 129 | ## OUTPUTS 130 | 131 | ### GitLab.User.Key 132 | 133 | ## NOTES 134 | 135 | ## RELATED LINKS 136 | -------------------------------------------------------------------------------- /docs/Restart-GitLabPipeline.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Restart-GitLabPipeline 9 | 10 | ## SYNOPSIS 11 | Restarts a pipeline. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Restart-GitLabPipeline [-ProjectID] [-Id] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Restart a pipeline what is not currently running or pending. 21 | 22 | ## EXAMPLES 23 | 24 | ### Example 1 25 | ```powershell 26 | PS C:\> Restart-GitLabPipeline -ProjectID 1 -Id 17 27 | ``` 28 | 29 | Restart the pipeline 17 for the project identified by Id 1 30 | 31 | ## PARAMETERS 32 | 33 | ### -Id 34 | {{Fill Id Description}} 35 | 36 | ```yaml 37 | Type: Int32 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: 1 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -ProjectID 49 | {{Fill ProjectID Description}} 50 | 51 | ```yaml 52 | Type: Int32 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: True 57 | Position: 0 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### CommonParameters 64 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 65 | 66 | ## INPUTS 67 | 68 | ### None 69 | 70 | ## OUTPUTS 71 | 72 | ### GitLab.Project.Pipeline 73 | 74 | ## NOTES 75 | 76 | ## RELATED LINKS 77 | 78 | [GitLab pipelines API](https://docs.gitlab.com/ee/api/pipelines.html) 79 | -------------------------------------------------------------------------------- /docs/Save-GitLabAPIConfiguration.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Save-GitLabAPIConfiguration 9 | 10 | ## SYNOPSIS 11 | Used to store information about your GitLab instance. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Save-GitLabAPIConfiguration [-Token] [-Domain] [-APIVersion ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Used to store information about your GitLab instance. 21 | The domain and api token are given. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Save-GitLabAPIConfiguration -Domain http://gitlab.com -Token "mPnTssWyBCMjxxxxxxxJQ" 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -APIVersion 33 | The version of API used to execute calls. 34 | 35 | ```yaml 36 | Type: Object 37 | Parameter Sets: (All) 38 | Aliases: 39 | 40 | Required: False 41 | Position: Named 42 | Default value: 4 43 | Accept pipeline input: False 44 | Accept wildcard characters: False 45 | ``` 46 | 47 | ### -Domain 48 | The domain your GitLab instance runs under. 49 | Example: http://gitlab.com. 50 | 51 | ```yaml 52 | Type: Object 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: True 57 | Position: 2 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### -Token 64 | Your private token that can be found under the profile settings. 65 | 66 | ```yaml 67 | Type: Object 68 | Parameter Sets: (All) 69 | Aliases: 70 | 71 | Required: True 72 | Position: 1 73 | Default value: None 74 | Accept pipeline input: False 75 | Accept wildcard characters: False 76 | ``` 77 | 78 | ### CommonParameters 79 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 80 | 81 | ## INPUTS 82 | 83 | ## OUTPUTS 84 | 85 | ## NOTES 86 | Implemented using Export-CLIXML saving the configurations. 87 | Stores .xml in $env:appdata\GitLabAPI\ 88 | 89 | ## RELATED LINKS 90 | 91 | [GitLab API](https://docs.gitlab.com/ee/api/README.html) 92 | [Personal access tokens](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html) 93 | -------------------------------------------------------------------------------- /docs/Search-GitLabUser.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Search-GitLabUser 9 | 10 | ## SYNOPSIS 11 | Retrives a GitLab user. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Search-GitLabUser [-User] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Retrives a GitLab user. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Search-GitLabUser ngetchell 27 | ``` 28 | 29 | name : Nicholas Getchell 30 | username : ngetchell 31 | id : 2 32 | state : active 33 | is_admin : true 34 | 35 | ## PARAMETERS 36 | 37 | ### -User 38 | The search criteria for the user. 39 | 40 | ```yaml 41 | Type: String 42 | Parameter Sets: (All) 43 | Aliases: 44 | 45 | Required: True 46 | Position: 1 47 | Default value: None 48 | Accept pipeline input: False 49 | Accept wildcard characters: False 50 | ``` 51 | 52 | ### CommonParameters 53 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 54 | 55 | ## INPUTS 56 | 57 | ## OUTPUTS 58 | 59 | ## NOTES 60 | 61 | ## RELATED LINKS 62 | -------------------------------------------------------------------------------- /docs/Set-GitLabMilestone.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Set-GitLabMilestone 9 | 10 | ## SYNOPSIS 11 | Modify your GitLab milestone. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Set-GitLabMilestone [-ProjectId] [-ID] [[-Title] ] [[-Description] ] 17 | [[-DueDate] ] [[-StateEvent] ] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Modify your GitLab milestone. 22 | Useful for changing the names or other parameter of your milestone. 23 | 24 | ## EXAMPLES 25 | 26 | ### EXAMPLE 1 27 | ``` 28 | Set-GitLabMilestone -ProjectId 8 -Id 32 -Name "NewName" 29 | ``` 30 | 31 | ### EXAMPLE 2 32 | ``` 33 | Get-GitLabMilestone -ProjectId 8 | Set-GitLabMilestone -Description 'Fake Description' 34 | ``` 35 | 36 | ## PARAMETERS 37 | 38 | ### -ProjectId 39 | The ID of a project. 40 | 41 | ```yaml 42 | Type: String 43 | Parameter Sets: (All) 44 | Aliases: project_id 45 | 46 | Required: True 47 | Position: 1 48 | Default value: None 49 | Accept pipeline input: True (ByPropertyName) 50 | Accept wildcard characters: False 51 | ``` 52 | 53 | ### -ID 54 | Milestone Id. 55 | 56 | ```yaml 57 | Type: String[] 58 | Parameter Sets: (All) 59 | Aliases: 60 | 61 | Required: True 62 | Position: 2 63 | Default value: None 64 | Accept pipeline input: True (ByPropertyName) 65 | Accept wildcard characters: False 66 | ``` 67 | 68 | ### -Title 69 | The title of an milestone. 70 | 71 | ```yaml 72 | Type: String 73 | Parameter Sets: (All) 74 | Aliases: 75 | 76 | Required: False 77 | Position: 3 78 | Default value: None 79 | Accept pipeline input: False 80 | Accept wildcard characters: False 81 | ``` 82 | 83 | ### -Description 84 | The description of an milestone 85 | 86 | ```yaml 87 | Type: String 88 | Parameter Sets: (All) 89 | Aliases: 90 | 91 | Required: False 92 | Position: 4 93 | Default value: None 94 | Accept pipeline input: False 95 | Accept wildcard characters: False 96 | ``` 97 | 98 | ### -DueDate 99 | The due date of the milestone. 100 | 101 | ```yaml 102 | Type: DateTime 103 | Parameter Sets: (All) 104 | Aliases: 105 | 106 | Required: False 107 | Position: 5 108 | Default value: None 109 | Accept pipeline input: False 110 | Accept wildcard characters: False 111 | ``` 112 | 113 | ### -StateEvent 114 | Whether closed or open. 115 | 116 | ```yaml 117 | Type: String 118 | Parameter Sets: (All) 119 | Aliases: state_event 120 | 121 | Required: False 122 | Position: 6 123 | Default value: None 124 | Accept pipeline input: False 125 | Accept wildcard characters: False 126 | ``` 127 | 128 | ### CommonParameters 129 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 130 | 131 | ## INPUTS 132 | 133 | ## OUTPUTS 134 | 135 | ## NOTES 136 | 137 | ## RELATED LINKS 138 | -------------------------------------------------------------------------------- /docs/Set-GitLabProject.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Set-GitLabProject 9 | 10 | ## SYNOPSIS 11 | Modify your GitLab projects. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Set-GitLabProject -ID [-Name ] [-Path ] [-Description ] 17 | [-VisabilityLevel ] [-Passthru] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Modify your GitLab projects. 22 | Useful for changing the names or changing the visibility of your project. 23 | 24 | ## EXAMPLES 25 | 26 | ### EXAMPLE 1 27 | ``` 28 | Set-GitLabProject -Id 32 -Name "NewName" 29 | ``` 30 | 31 | ### EXAMPLE 2 32 | ``` 33 | Get-GitLabProject | Set-GitLabProject -Description 'Fake Description' 34 | ``` 35 | 36 | ## PARAMETERS 37 | 38 | ### -ID 39 | The project ID. 40 | 41 | ```yaml 42 | Type: String[] 43 | Parameter Sets: (All) 44 | Aliases: 45 | 46 | Required: True 47 | Position: Named 48 | Default value: None 49 | Accept pipeline input: True (ByPropertyName) 50 | Accept wildcard characters: False 51 | ``` 52 | 53 | ### -Name 54 | The name of the new project. 55 | 56 | ```yaml 57 | Type: String 58 | Parameter Sets: (All) 59 | Aliases: 60 | 61 | Required: False 62 | Position: Named 63 | Default value: None 64 | Accept pipeline input: False 65 | Accept wildcard characters: False 66 | ``` 67 | 68 | ### -Path 69 | Custom repository name for new project. 70 | By default generated based on name. 71 | 72 | ```yaml 73 | Type: String 74 | Parameter Sets: (All) 75 | Aliases: 76 | 77 | Required: False 78 | Position: Named 79 | Default value: None 80 | Accept pipeline input: False 81 | Accept wildcard characters: False 82 | ``` 83 | 84 | ### -Description 85 | The description of the project. 86 | 87 | ```yaml 88 | Type: String 89 | Parameter Sets: (All) 90 | Aliases: 91 | 92 | Required: False 93 | Position: Named 94 | Default value: None 95 | Accept pipeline input: False 96 | Accept wildcard characters: False 97 | ``` 98 | 99 | ### -VisabilityLevel 100 | \[Alias('issues_enabled')\] 101 | \[switch\]$IssuesEnabled = $false, 102 | $merge_requests_enabled, 103 | $wiki_enabled, 104 | $snippets_enabled, 105 | $public, 106 | 107 | ```yaml 108 | Type: Object 109 | Parameter Sets: (All) 110 | Aliases: visibility_level 111 | 112 | Required: False 113 | Position: Named 114 | Default value: None 115 | Accept pipeline input: False 116 | Accept wildcard characters: False 117 | ``` 118 | 119 | ### -Passthru 120 | Whether to return the project to the pipeline. 121 | 122 | ```yaml 123 | Type: SwitchParameter 124 | Parameter Sets: (All) 125 | Aliases: 126 | 127 | Required: False 128 | Position: Named 129 | Default value: False 130 | Accept pipeline input: False 131 | Accept wildcard characters: False 132 | ``` 133 | 134 | ### CommonParameters 135 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 136 | 137 | ## INPUTS 138 | 139 | ## OUTPUTS 140 | 141 | ## NOTES 142 | 143 | ## RELATED LINKS 144 | -------------------------------------------------------------------------------- /docs/Set-GitLabProjectServiceMSTeams.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Set-GitLabProjectServiceMSTeams 9 | 10 | ## SYNOPSIS 11 | Set and adding the Teams service for a project. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Set-GitLabProjectServiceMSTeams [-Id ] [-Namespace ] -webhook [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Set and adding the Teams service for a project. 21 | 22 | ## EXAMPLES 23 | 24 | ### Example 1 25 | ``` 26 | PS C:\> Set-GitLabProjectServiceMSTeams -Id 12 -Webhook 'http://example.hook' 27 | ``` 28 | 29 | Add the Example webhook to project 12. 30 | 31 | ## PARAMETERS 32 | 33 | ### -Id 34 | Project ID 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: False 42 | Position: Named 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -Namespace 49 | Name of the project in namespace format. 50 | 51 | ```yaml 52 | Type: String 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: False 57 | Position: Named 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### -webhook 64 | MSTeams Webhook 65 | 66 | ```yaml 67 | Type: String 68 | Parameter Sets: (All) 69 | Aliases: 70 | 71 | Required: True 72 | Position: Named 73 | Default value: None 74 | Accept pipeline input: False 75 | Accept wildcard characters: False 76 | ``` 77 | 78 | ### CommonParameters 79 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 80 | 81 | ## INPUTS 82 | 83 | ### None 84 | 85 | ## OUTPUTS 86 | 87 | ### GitLab.Project.Service.MSTeams 88 | 89 | ## NOTES 90 | 91 | ## RELATED LINKS 92 | -------------------------------------------------------------------------------- /docs/Set-GitLabProjectServiceSlack.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: https://docs.gitlab.com/ce/api/services.html#get-slack-service-settings 5 | schema: 2.0.0 6 | --- 7 | 8 | # Set-GitLabProjectServiceSlack 9 | 10 | ## SYNOPSIS 11 | Set the Slack Webhook 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Set-GitLabProjectServiceSlack [-Id ] [-Namespace ] -webhook [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Enables Slack notification from gitlab 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Set-GitLabProjectServiceSlack -Webhook https://hooks.slack.com/asfdss -Id 1 27 | ``` 28 | 29 | Sets the webhook on project id 1 30 | 31 | ## PARAMETERS 32 | 33 | ### -Id 34 | Project Id. 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: False 42 | Position: Named 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -Namespace 49 | Project Namespace. 50 | 51 | ```yaml 52 | Type: String 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: False 57 | Position: Named 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### -webhook 64 | Slack webhook. 65 | 66 | ```yaml 67 | Type: String 68 | Parameter Sets: (All) 69 | Aliases: 70 | 71 | Required: True 72 | Position: Named 73 | Default value: None 74 | Accept pipeline input: False 75 | Accept wildcard characters: False 76 | ``` 77 | 78 | ### CommonParameters 79 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 80 | 81 | ## INPUTS 82 | 83 | ## OUTPUTS 84 | 85 | ### GitLab.Project.Service.Slack 86 | 87 | ## NOTES 88 | 89 | ## RELATED LINKS 90 | 91 | [https://docs.gitlab.com/ce/api/services.html#get-slack-service-settings](https://docs.gitlab.com/ce/api/services.html#get-slack-service-settings) 92 | 93 | -------------------------------------------------------------------------------- /docs/Set-GitLabRunner.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Set-GitLabRunner 9 | 10 | ## SYNOPSIS 11 | Updates a runner's details. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Set-GitLabRunner -Id [-Description ] [-Active ] [-Tags ] 17 | [-RunUntagged ] [-Locked ] [-AccessLevel ] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Updates a runner's details. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Set-GitLabRunner -Id 400 -Active $true -Locked $false 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -Id 33 | The ID of the GitLab runner to update. 34 | 35 | ```yaml 36 | Type: Int32 37 | Parameter Sets: (All) 38 | Aliases: 39 | 40 | Required: True 41 | Position: Named 42 | Default value: None 43 | Accept pipeline input: False 44 | Accept wildcard characters: False 45 | ``` 46 | 47 | ### -Description 48 | The description of a runner. 49 | 50 | ```yaml 51 | Type: String 52 | Parameter Sets: (All) 53 | Aliases: 54 | 55 | Required: False 56 | Position: Named 57 | Default value: None 58 | Accept pipeline input: False 59 | Accept wildcard characters: False 60 | ``` 61 | 62 | ### -Active 63 | The state of a runner; can be set to true or false. 64 | 65 | ```yaml 66 | Type: String 67 | Parameter Sets: (All) 68 | Aliases: 69 | 70 | Required: False 71 | Position: Named 72 | Default value: None 73 | Accept pipeline input: False 74 | Accept wildcard characters: False 75 | ``` 76 | 77 | ### -Tags 78 | The comma-separated list of tags for a runner. 79 | 80 | ```yaml 81 | Type: String 82 | Parameter Sets: (All) 83 | Aliases: 84 | 85 | Required: False 86 | Position: Named 87 | Default value: None 88 | Accept pipeline input: False 89 | Accept wildcard characters: False 90 | ``` 91 | 92 | ### -RunUntagged 93 | Flag indicating the runner can execute untagged jobs. 94 | 95 | ```yaml 96 | Type: String 97 | Parameter Sets: (All) 98 | Aliases: 99 | 100 | Required: False 101 | Position: Named 102 | Default value: None 103 | Accept pipeline input: False 104 | Accept wildcard characters: False 105 | ``` 106 | 107 | ### -Locked 108 | Flag indicating the runner is locked to the current project. 109 | 110 | ```yaml 111 | Type: String 112 | Parameter Sets: (All) 113 | Aliases: 114 | 115 | Required: False 116 | Position: Named 117 | Default value: None 118 | Accept pipeline input: False 119 | Accept wildcard characters: False 120 | ``` 121 | 122 | ### -AccessLevel 123 | The access level of the runner; not_protected or ref_protected 124 | 125 | ```yaml 126 | Type: String 127 | Parameter Sets: (All) 128 | Aliases: 129 | 130 | Required: False 131 | Position: Named 132 | Default value: None 133 | Accept pipeline input: False 134 | Accept wildcard characters: False 135 | ``` 136 | 137 | ### CommonParameters 138 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 139 | 140 | ## INPUTS 141 | 142 | ## OUTPUTS 143 | 144 | ## NOTES 145 | 146 | ## RELATED LINKS 147 | 148 | [Update runner's details](https://docs.gitlab.com/ce/api/runners.html#update-runner-s-details) -------------------------------------------------------------------------------- /docs/Start-GitLabPipeline.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Start-GitLabPipeline 9 | 10 | ## SYNOPSIS 11 | Creates a pipeline. 12 | 13 | ## SYNTAX 14 | 15 | ### ByBranch 16 | ``` 17 | Start-GitLabPipeline -ProjectID -Branch [] 18 | ``` 19 | 20 | ### ByTag 21 | ``` 22 | Start-GitLabPipeline -ProjectID -Tag [] 23 | ``` 24 | 25 | ## DESCRIPTION 26 | Creates a pipeline for a project and a reference (a branch or a tag). 27 | 28 | ## EXAMPLES 29 | 30 | ### Example 1 31 | ```powershell 32 | PS C:\> Start-GitLabPipeline -ProjectID 1 -Tag v3.0.0 33 | ``` 34 | 35 | Creates a pipeline for the project with ID 1 and the tag 'v3.0.0 36 | 37 | ## PARAMETERS 38 | 39 | ### -Branch 40 | Reference as a branch name. 41 | 42 | ```yaml 43 | Type: String 44 | Parameter Sets: ByBranch 45 | Aliases: 46 | 47 | Required: True 48 | Position: Named 49 | Default value: None 50 | Accept pipeline input: False 51 | Accept wildcard characters: False 52 | ``` 53 | 54 | ### -ProjectID 55 | The ID or NAMESPACE/PROJECT_NAME of the project. 56 | 57 | ```yaml 58 | Type: Int32 59 | Parameter Sets: (All) 60 | Aliases: 61 | 62 | Required: True 63 | Position: Named 64 | Default value: None 65 | Accept pipeline input: False 66 | Accept wildcard characters: False 67 | ``` 68 | 69 | ### -Tag 70 | Reference as a tag name. 71 | 72 | ```yaml 73 | Type: String 74 | Parameter Sets: ByTag 75 | Aliases: 76 | 77 | Required: True 78 | Position: Named 79 | Default value: None 80 | Accept pipeline input: False 81 | Accept wildcard characters: False 82 | ``` 83 | 84 | ### CommonParameters 85 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 86 | 87 | ## INPUTS 88 | 89 | ### None 90 | 91 | ## OUTPUTS 92 | 93 | ### GitLab.Project.Pipeline 94 | 95 | ## NOTES 96 | 97 | ## RELATED LINKS 98 | 99 | [GitLab pipelines API](https://docs.gitlab.com/ee/api/pipelines.html) 100 | -------------------------------------------------------------------------------- /docs/Stop-GitLabPipeline.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Stop-GitLabPipeline 9 | 10 | ## SYNOPSIS 11 | Stop/cancel a pipeline. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Stop-GitLabPipeline [-ProjectID] [-Id] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Stops a currently running pipeline. 21 | 22 | ## EXAMPLES 23 | 24 | ### Example 1 25 | ```powershell 26 | PS C:\> Stop-GitLabPipeline -ProjectID 1 -Id 17 27 | ``` 28 | 29 | Stops the pipeline 17 for the project with the ID 1. 30 | 31 | ## PARAMETERS 32 | 33 | ### -Id 34 | The Id of pipeline. 35 | 36 | ```yaml 37 | Type: Int32 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: 1 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -ProjectID 49 | The ID or NAMESPACE/PROJECT_NAME of the project. 50 | 51 | ```yaml 52 | Type: Int32 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: True 57 | Position: 0 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### CommonParameters 64 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 65 | 66 | ## INPUTS 67 | 68 | ### None 69 | 70 | ## OUTPUTS 71 | 72 | ### GitLab.Project.Pipeline 73 | 74 | ## NOTES 75 | 76 | ## RELATED LINKS 77 | 78 | [GitLab pipelines API](https://docs.gitlab.com/ee/api/pipelines.html) 79 | -------------------------------------------------------------------------------- /docs/Test-GitLabAPI.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Test-GitLabAPI 9 | 10 | ## SYNOPSIS 11 | Used to check your configuration. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Test-GitLabAPI [-Version ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Used to check your configuration. 21 | Calls an API to test the token. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Test-GitLabAPI 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -Version 33 | {{Fill Version Description}} 34 | 35 | ```yaml 36 | Type: String 37 | Parameter Sets: (All) 38 | Aliases: 39 | 40 | Required: False 41 | Position: Named 42 | Default value: None 43 | Accept pipeline input: False 44 | Accept wildcard characters: False 45 | ``` 46 | 47 | ### CommonParameters 48 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 49 | 50 | ## INPUTS 51 | 52 | ## OUTPUTS 53 | 54 | ## NOTES 55 | 56 | ## RELATED LINKS 57 | -------------------------------------------------------------------------------- /docs/Unblock-GitLabUser.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PSGitLab-help.xml 3 | Module Name: PSGitLab 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Unblock-GitLabUser 9 | 10 | ## SYNOPSIS 11 | Used to unblock gitlab users. 12 | 13 | ## SYNTAX 14 | 15 | ### ID (Default) 16 | ``` 17 | Unblock-GitLabUser -ID [-Passthru] [] 18 | ``` 19 | 20 | ### Username 21 | ``` 22 | Unblock-GitLabUser -Username [-Passthru] [] 23 | ``` 24 | 25 | ### Email 26 | ``` 27 | Unblock-GitLabUser -Email [-Passthru] [] 28 | ``` 29 | 30 | ## DESCRIPTION 31 | Used to unblock gitlab users. 32 | Can be done form the parameters or from the pipeline. 33 | 34 | ## EXAMPLES 35 | 36 | ### EXAMPLE 1 37 | ``` 38 | Unlock-GitLabUser -ID 22 39 | ``` 40 | 41 | ### EXAMPLE 2 42 | ``` 43 | Unlock-GitLabUser -Email fake@email.com 44 | ``` 45 | 46 | ### EXAMPLE 3 47 | ``` 48 | Unlock-GitLabUser -Username fake 49 | ``` 50 | 51 | ### EXAMPLE 4 52 | ``` 53 | Get-GitLabUser -Username fake | Unblock-GitLabUser 54 | ``` 55 | 56 | ## PARAMETERS 57 | 58 | ### -ID 59 | The user ID. 60 | 61 | ```yaml 62 | Type: String 63 | Parameter Sets: ID 64 | Aliases: 65 | 66 | Required: True 67 | Position: Named 68 | Default value: None 69 | Accept pipeline input: True (ByPropertyName) 70 | Accept wildcard characters: False 71 | ``` 72 | 73 | ### -Username 74 | The username for the user. 75 | 76 | ```yaml 77 | Type: String 78 | Parameter Sets: Username 79 | Aliases: 80 | 81 | Required: True 82 | Position: Named 83 | Default value: None 84 | Accept pipeline input: False 85 | Accept wildcard characters: False 86 | ``` 87 | 88 | ### -Email 89 | The email address for the user. 90 | 91 | ```yaml 92 | Type: String 93 | Parameter Sets: Email 94 | Aliases: 95 | 96 | Required: True 97 | Position: Named 98 | Default value: None 99 | Accept pipeline input: False 100 | Accept wildcard characters: False 101 | ``` 102 | 103 | ### -Passthru 104 | To return the unblocked user to the pipeline. 105 | 106 | ```yaml 107 | Type: SwitchParameter 108 | Parameter Sets: (All) 109 | Aliases: 110 | 111 | Required: False 112 | Position: Named 113 | Default value: False 114 | Accept pipeline input: False 115 | Accept wildcard characters: False 116 | ``` 117 | 118 | ### CommonParameters 119 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 120 | 121 | ## INPUTS 122 | 123 | ## OUTPUTS 124 | 125 | ## NOTES 126 | 127 | ## RELATED LINKS 128 | -------------------------------------------------------------------------------- /module.psdeploy.ps1: -------------------------------------------------------------------------------- 1 | if($ENV:BHProjectName -and $ENV:BHProjectName.Count -eq 1) { 2 | Deploy "$ENV:BHProjectName => PSGallery" { 3 | By PSGalleryModule { 4 | FromSource $ENV:BHProjectName 5 | To PSGallery 6 | WithOptions @{ 7 | ApiKey = $ENV:PSGalleryApiKey 8 | } 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /run-tests.ps1: -------------------------------------------------------------------------------- 1 | $testResults = Invoke-Pester -Path "$PSScriptRoot\Tests" -PassThru 2 | if ($testResults.FailedCount -gt 0) { 3 | Write-Error -Message 'One or more tests failed. Exiting with error/stopping deployment.' 4 | exit 1 5 | } 6 | 7 | if ($testResults.TotalCount -le 0) { 8 | Write-Error -Message 'no tests were run. Exiting with error/stopping deployment.' 9 | exit 1 10 | } -------------------------------------------------------------------------------- /runTests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | echo "Building Docker containers..." 6 | docker-compose -f ./docker/docker-compose.yml up -d gitlab 7 | echo "Waiting for Docker containers to finish setting up..." 8 | attempt=1 9 | MAX_TRIES=60 10 | while [ ! -f ./docker/config/token ]; do 11 | sleep 10 12 | if [ $attempt -gt $MAX_TRIES ]; then 13 | echo "Error: Gitlab not responding, cancelling set up" 14 | if [ "$GITHUB_ACTIONS" != "true" ]; 15 | then rm -f ./docker/config/token; 16 | fi 17 | exit 1 18 | fi 19 | done 20 | docker-compose -f ./docker/docker-compose.yml run test 21 | echo "Tests complete, stop and remove Docker containers..." 22 | docker-compose -f ./docker/docker-compose.yml down 23 | if [ "$GITHUB_ACTIONS" != "true" ]; 24 | then rm -f ./docker/config/token; 25 | fi --------------------------------------------------------------------------------