Skip to content

Commit 421c83e

Browse files
committed
Update help descriptions and devops files.
1 parent 64d035a commit 421c83e

113 files changed

Lines changed: 33 additions & 13420 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
output
2+
docs

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
Please note that backwards compatibility breaks are prefixed with `{"BC"}` (short for Breaking Change).
44

5+
## 2024-02-18 - Version 2.0.0-RC4
6+
7+
* Change secret vault to use the SecretManagement module.
8+
59
## 2024-02-16 - Version 2.0.0-RC3
610

711
* Fix broken ticket commandlet.

Source/Public/Connect-NinjaOne.ps1

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ function Connect-NinjaOne {
1919
2020
This logs into NinjaOne using the refresh token flow.
2121
.EXAMPLE
22-
PS> Connect-NinjaOne -UseSecretManagement -VaultName 'NinjaOneVault' -WriteToSecretVault
22+
PS> Connect-NinjaOne -UseSecretManagement -VaultName 'NinjaOneVault' -WriteToSecretVault -Instance 'eu' -ClientId 'AAaaA1aaAaAA-aaAaaA11a1A-aA' -ClientSecret '00Z00zzZzzzZzZzZzZzZZZ0zZ0zzZ_0zzz0zZZzzZz0Z0ZZZzz0z0Z' -UseClientAuth
23+
24+
This logs into NinjaOne using the client credentials flow and writes the connection information to the secret vault.
25+
.EXAMPLE
26+
PS> Connect-NinjaOne -UseSecretManagement -VaultName 'NinjaOneVault' -ReadFromSecretVault
27+
28+
This reads the connection information from the secret vault.
2329
.OUTPUTS
2430
Sets two script-scoped variables to hold connection and authentication information.
2531
.LINK
@@ -85,7 +91,7 @@ function Connect-NinjaOne {
8591
[Parameter( ParameterSetName = 'Token Authentication' )]
8692
[Parameter( ParameterSetName = 'Client Credentials' )]
8793
[Switch]$ShowTokens,
88-
# Use the secret management module to retrieve credentials and store tokens.
94+
# Use the secret management module to retrieve credentials and store tokens. Check the docs on setting up the secret management module at https://docs.homotechsual.dev/common/secretmanagement.
8995
[Parameter( ParameterSetName = 'Authorisation Code' )]
9096
[Parameter( ParameterSetName = 'Token Authentication' )]
9197
[Parameter( ParameterSetName = 'Client Credentials' )]

build.ps1

Lines changed: 20 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
#>
55
[CmdletBinding()]
66
Param (
7-
[String[]]$TaskNames = ('clean', 'build', 'test', 'updateManifest', 'publish', 'updateHelp', 'generateShortNamesMapping', 'push'),
7+
[ValidateSet('clean', 'build', 'updateManifest', 'publish', 'updateHelp', 'generateShortNamesMapping', 'push')]
8+
[String[]]$TaskNames = ('clean', 'build', 'updateManifest', 'publish', 'updateHelp', 'generateShortNamesMapping', 'push'),
9+
[ValidateSet('origin', 'homotechsual')]
810
[String[]]$Remotes = @('origin', 'homotechsual'),
911
[Hashtable]$BuildConfig = (
10-
Join-Path -Path $PSScriptRoot -ChildPath 'buildConfig.psd1' | Import-PowerShellDataFile -LiteralPath { $_ } -ErrorAction SilentlyContinue
12+
Join-Path -Path $PSScriptRoot -ChildPath 'Source' | Join-Path -ChildPath 'build.psd1' | Import-PowerShellDataFile -LiteralPath { $_ } -ErrorAction SilentlyContinue
1113
),
1214
[Switch]$ExcludeCustomTasks = $false,
1315
[System.Management.Automation.SemanticVersion]$SemVer
@@ -20,14 +22,28 @@ if (-Not(Get-Module -Name 'Install-RequiredModule')) {
2022
Install-RequiredModule -RequiredModulesFile ('{0}\RequiredModules.psd1' -f $PSScriptRoot) -Scope CurrentUser -TrustRegisteredRepositories -Import -Quiet
2123
# Use strict mode when building.
2224
Set-StrictMode -Version Latest
25+
# Helper: Get the module PSD1 file path.
26+
function GetModulePath {
27+
[CmdletBinding()]
28+
param(
29+
[Parameter(Mandatory)]
30+
[String]$ModuleName
31+
)
32+
$ModulePath = (Get-ChildItem -Path ('{0}\Output\*\*\{1}.psd1' -f $PSScriptRoot, $ModuleName)).FullName
33+
if (!(Test-Path -Path $ModulePath)) {
34+
throw ('Module {0} not found at "{1}".' -f $ModuleName, $ModulePath)
35+
}
36+
return $ModulePath
37+
}
2338
# Helper: Get functions from the module.
2439
function GetFunctions {
2540
[CmdletBinding()]
2641
param(
2742
[Parameter(Mandatory)]
2843
[String]$ModuleName
2944
)
30-
Import-Module ('.\Source\{0}.psd1' -f $Script:ModuleName) -Force
45+
$ModulePath = GetModulePath -ModuleName $ModuleName
46+
Import-Module $ModulePath -Force
3147
$Module = Get-Module -Name $Script:ModuleName
3248
$CommandletList = [System.Collections.Generic.List[String]]::new()
3349
$CommandletList.AddRange($Module.ExportedFunctions.Keys)
@@ -90,7 +106,7 @@ This page has been generated from the {0} PowerShell module source. To make chan
90106
'@ -f $Script:ModuleName
91107
$ExcludeFiles = Get-ChildItem -Path "$($PSScriptRoot)\Private" -Filter '*.ps1' -Recurse | ForEach-Object { [System.IO.Path]::GetFileNameWithoutExtension($_.FullName) }
92108
$NewDocusaurusHelpParams = @{
93-
Module = ('.\Source\{0}.psd1' -f $Script:ModuleName)
109+
Module = (GetModulePath -ModuleName $Script:ModuleName)
94110
DocsFolder = $DocsFolderPath
95111
Exclude = $ExcludeFiles
96112
Sidebar = 'commandlets'
@@ -226,37 +242,6 @@ This page has been generated from the {0} PowerShell module source. To make chan
226242
function Build {
227243
Build-Module -Path '.\Source' -SemVer $SemVer.ToString()
228244
}
229-
# Task: Copy PowerShell Module files to output folder for release on PSGallery
230-
function CopyModuleFiles {
231-
# Copy Module Files to Output Folder
232-
if (-not (Test-Path "$($PSScriptRoot)\Output\$Script:ModuleName")) {
233-
New-Item -Path "$($PSScriptRoot)\Output\$Script:ModuleName" -ItemType Directory | Out-Null
234-
}
235-
if (Test-Path -Path "$($PSScriptRoot)\Classes\") {
236-
Copy-Item -Path "$($PSScriptRoot)\Classes\" -Filter *.* -Recurse -Destination "$($PSScriptRoot)\Output\$Script:ModuleName" -Force
237-
}
238-
if (Test-Path -Path "$($PSScriptRoot)\Data\") {
239-
Copy-Item -Path "$($PSScriptRoot)\Data\" -Filter *.* -Recurse -Destination "$($PSScriptRoot)\Output\$Script:ModuleName" -Force
240-
}
241-
Copy-Item -Path "$($PSScriptRoot)\Private\" -Filter *.* -Recurse -Destination "$($PSScriptRoot)\Output\$Script:ModuleName" -Force
242-
Copy-Item -Path "$($PSScriptRoot)\Public\" -Filter *.* -Recurse -Destination "$($PSScriptRoot)\Output\$Script:ModuleName" -Force
243-
244-
# Copy module, manifest and scaffold files
245-
Copy-Item -Path @(
246-
"$($PSScriptRoot)\LICENSE.md"
247-
"$($PSScriptRoot)\CHANGELOG.md"
248-
"$($PSScriptRoot)\README.md"
249-
"$($PSScriptRoot)\$Script:ModuleName.psd1"
250-
"$($PSScriptRoot)\$Script:ModuleName.psm1"
251-
) -Destination "$($PSScriptRoot)\Output\$Script:ModuleName" -Force
252-
}
253-
# Task: Run all Pester tests in folder .\Tests
254-
function Test {
255-
$Result = Invoke-Pester "$($PSScriptRoot)\Tests" -PassThru
256-
if ($Result.FailedCount -gt 0) {
257-
throw 'Pester tests failed'
258-
}
259-
}
260245
# Task: Update the Module Manifest file with info from the Changelog.
261246
function UpdateManifest {
262247
# Import PlatyPS. Needed for parsing the versions in the Changelog.

docs/NinjaOne/commandlets/connect/Connect-NinjaOne.mdx

Lines changed: 0 additions & 263 deletions
This file was deleted.

0 commit comments

Comments
 (0)