Posh-ACME.psm1
#Requires -Version 5.1 # Get public and private function definition files. $Public = @( Get-ChildItem -Path $PSScriptRoot\Public\*.ps1 -ErrorAction SilentlyContinue ) $Private = @( Get-ChildItem -Path $PSScriptRoot\Private\*.ps1 -ErrorAction SilentlyContinue ) # Dot source the files Foreach($import in @($Public + $Private)) { Try { . $import.fullname } Catch { Write-Error -Message "Failed to import function $($import.fullname): $_" } } # Export everything in the public folder Export-ModuleMember -Function $Public.Basename # setup some module wide variables $script:WellKnownDirs = @{ LE_PROD = 'https://acme-v02.api.letsencrypt.org/directory'; LE_STAGE = 'https://acme-staging-v02.api.letsencrypt.org/directory'; } $script:HEADER_NONCE = 'Replay-Nonce' $script:USER_AGENT = "Posh-ACME/1.1 PowerShell/$($PSVersionTable.PSVersion)" $script:COMMON_HEADERS = @{'Accept-Language'='en-us,en;q=0.5'} $script:CONTENT_TYPE = 'application/jose+json' # setup the DnsPlugin argument completer # https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/register-argumentcompleter?view=powershell-5.1 Register-ArgumentCompleter -CommandName 'New-PACertificate','Submit-ChallengeValidation' -ParameterName 'DnsPlugin' -ScriptBlock { param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) #$names = 'Infoblox','GCloud','Route53','Windows' | Sort-Object $names = (Get-ChildItem -Path $PSScriptRoot\DnsPlugins\*.ps1 -Exclude '_Example.ps1').BaseName $names | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object { [Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) } } Import-PAConfig |