From 5fbf612593999154145b003c7ffa1ede30834e48 Mon Sep 17 00:00:00 2001 From: Justin Emerson Date: Thu, 23 Jul 2026 14:19:07 -0700 Subject: [PATCH 1/8] Add Add-PfbCommonQueryParams helper function and unit tests (#32) Adds Private/Add-PfbCommonQueryParams.ps1 with the shared helper that centralizes -Filter/-Sort/-Limit/-TotalOnly/-Names/-Ids parameter handling across all 30 Get-Pfb* cmdlets. Includes comprehensive Pester tests covering all scalar parameters individually, ContainsKey semantics (including -Limit 0 edge case), Names/Ids array joining, and in-place hashtable mutation. All 24 tests pass. --- Private/Add-PfbCommonQueryParams.ps1 | 24 ++ Tests/Add-PfbCommonQueryParams.Tests.ps1 | 329 +++++++++++++++++++++++ 2 files changed, 353 insertions(+) create mode 100644 Private/Add-PfbCommonQueryParams.ps1 create mode 100644 Tests/Add-PfbCommonQueryParams.Tests.ps1 diff --git a/Private/Add-PfbCommonQueryParams.ps1 b/Private/Add-PfbCommonQueryParams.ps1 new file mode 100644 index 0000000..7741128 --- /dev/null +++ b/Private/Add-PfbCommonQueryParams.ps1 @@ -0,0 +1,24 @@ +function Add-PfbCommonQueryParams { + <# + .SYNOPSIS + Adds common query parameters to a query-parameter hashtable. + .DESCRIPTION + Populates a hashtable with the standard -Filter, -Sort, -Limit, -TotalOnly, + -Names, and -Ids query parameters used across all Get-Pfb* cmdlets. Uses + ContainsKey semantics to detect bound parameters, allowing explicit passes + of falsy values (e.g. -Limit 0 or empty-string -Filter) to be included. + #> + [CmdletBinding()] + param( + [Parameter(Mandatory)][hashtable]$Into, + [Parameter(Mandatory)][System.Collections.IDictionary]$BoundParameters, + [string[]]$Names, + [string[]]$Ids + ) + if ($BoundParameters.ContainsKey('Filter')) { $Into['filter'] = $BoundParameters['Filter'] } + if ($BoundParameters.ContainsKey('Sort')) { $Into['sort'] = $BoundParameters['Sort'] } + if ($BoundParameters.ContainsKey('Limit')) { $Into['limit'] = $BoundParameters['Limit'] } + if ($BoundParameters.ContainsKey('TotalOnly')) { $Into['total_only'] = 'true' } + if ($Names) { $Into['names'] = $Names -join ',' } + if ($Ids) { $Into['ids'] = $Ids -join ',' } +} diff --git a/Tests/Add-PfbCommonQueryParams.Tests.ps1 b/Tests/Add-PfbCommonQueryParams.Tests.ps1 new file mode 100644 index 0000000..626c2db --- /dev/null +++ b/Tests/Add-PfbCommonQueryParams.Tests.ps1 @@ -0,0 +1,329 @@ +#Requires -Modules @{ ModuleName = 'Pester'; ModuleVersion = '5.0' } + +BeforeAll { + Import-Module "$PSScriptRoot/../PureStorageFlashBladePowerShell.psd1" -Force +} + +Describe 'Add-PfbCommonQueryParams' { + Context 'Filter parameter' { + It 'adds Filter to $Into when present in BoundParameters' { + InModuleScope PureStorageFlashBladePowerShell -Parameters @{ + Into = @{} + BoundParameters = @{ Filter = 'name=~foo' } + } { + param($Into, $BoundParameters) + Add-PfbCommonQueryParams -Into $Into -BoundParameters $BoundParameters + $Into.ContainsKey('filter') | Should -BeTrue + $Into['filter'] | Should -Be 'name=~foo' + } + } + + It 'does not add Filter to $Into when absent from BoundParameters' { + InModuleScope PureStorageFlashBladePowerShell -Parameters @{ + Into = @{} + BoundParameters = @{} + } { + param($Into, $BoundParameters) + Add-PfbCommonQueryParams -Into $Into -BoundParameters $BoundParameters + $Into.ContainsKey('filter') | Should -BeFalse + } + } + + It 'adds empty-string Filter when explicitly passed' { + InModuleScope PureStorageFlashBladePowerShell -Parameters @{ + Into = @{} + BoundParameters = @{ Filter = '' } + } { + param($Into, $BoundParameters) + Add-PfbCommonQueryParams -Into $Into -BoundParameters $BoundParameters + $Into.ContainsKey('filter') | Should -BeTrue + $Into['filter'] | Should -Be '' + } + } + } + + Context 'Sort parameter' { + It 'adds Sort to $Into when present in BoundParameters' { + InModuleScope PureStorageFlashBladePowerShell -Parameters @{ + Into = @{} + BoundParameters = @{ Sort = 'name' } + } { + param($Into, $BoundParameters) + Add-PfbCommonQueryParams -Into $Into -BoundParameters $BoundParameters + $Into.ContainsKey('sort') | Should -BeTrue + $Into['sort'] | Should -Be 'name' + } + } + + It 'does not add Sort to $Into when absent from BoundParameters' { + InModuleScope PureStorageFlashBladePowerShell -Parameters @{ + Into = @{} + BoundParameters = @{} + } { + param($Into, $BoundParameters) + Add-PfbCommonQueryParams -Into $Into -BoundParameters $BoundParameters + $Into.ContainsKey('sort') | Should -BeFalse + } + } + } + + Context 'Limit parameter' { + It 'adds Limit to $Into when present in BoundParameters' { + InModuleScope PureStorageFlashBladePowerShell -Parameters @{ + Into = @{} + BoundParameters = @{ Limit = 100 } + } { + param($Into, $BoundParameters) + Add-PfbCommonQueryParams -Into $Into -BoundParameters $BoundParameters + $Into.ContainsKey('limit') | Should -BeTrue + $Into['limit'] | Should -Be 100 + } + } + + It 'does not add Limit to $Into when absent from BoundParameters' { + InModuleScope PureStorageFlashBladePowerShell -Parameters @{ + Into = @{} + BoundParameters = @{} + } { + param($Into, $BoundParameters) + Add-PfbCommonQueryParams -Into $Into -BoundParameters $BoundParameters + $Into.ContainsKey('limit') | Should -BeFalse + } + } + + It 'adds Limit 0 when explicitly passed (proves ContainsKey semantics, not truthiness)' { + InModuleScope PureStorageFlashBladePowerShell -Parameters @{ + Into = @{} + BoundParameters = @{ Limit = 0 } + } { + param($Into, $BoundParameters) + Add-PfbCommonQueryParams -Into $Into -BoundParameters $BoundParameters + $Into.ContainsKey('limit') | Should -BeTrue + $Into['limit'] | Should -Be 0 + } + } + } + + Context 'TotalOnly parameter' { + It 'adds total_only = true to $Into when TotalOnly is present in BoundParameters' { + InModuleScope PureStorageFlashBladePowerShell -Parameters @{ + Into = @{} + BoundParameters = @{ TotalOnly = $true } + } { + param($Into, $BoundParameters) + Add-PfbCommonQueryParams -Into $Into -BoundParameters $BoundParameters + $Into.ContainsKey('total_only') | Should -BeTrue + $Into['total_only'] | Should -Be 'true' + } + } + + It 'does not add total_only to $Into when TotalOnly is absent from BoundParameters' { + InModuleScope PureStorageFlashBladePowerShell -Parameters @{ + Into = @{} + BoundParameters = @{} + } { + param($Into, $BoundParameters) + Add-PfbCommonQueryParams -Into $Into -BoundParameters $BoundParameters + $Into.ContainsKey('total_only') | Should -BeFalse + } + } + } + + Context 'Names parameter' { + It 'adds names joined by comma when Names are provided' { + InModuleScope PureStorageFlashBladePowerShell -Parameters @{ + Into = @{} + BoundParameters = @{} + Names = @('fs1', 'fs2', 'fs3') + } { + param($Into, $BoundParameters, $Names) + Add-PfbCommonQueryParams -Into $Into -BoundParameters $BoundParameters -Names $Names + $Into.ContainsKey('names') | Should -BeTrue + $Into['names'] | Should -Be 'fs1,fs2,fs3' + } + } + + It 'does not add names when Names are not provided' { + InModuleScope PureStorageFlashBladePowerShell -Parameters @{ + Into = @{} + BoundParameters = @{} + } { + param($Into, $BoundParameters) + Add-PfbCommonQueryParams -Into $Into -BoundParameters $BoundParameters + $Into.ContainsKey('names') | Should -BeFalse + } + } + + It 'does not add names when Names is an empty array' { + InModuleScope PureStorageFlashBladePowerShell -Parameters @{ + Into = @{} + BoundParameters = @{} + Names = @() + } { + param($Into, $BoundParameters, $Names) + Add-PfbCommonQueryParams -Into $Into -BoundParameters $BoundParameters -Names $Names + $Into.ContainsKey('names') | Should -BeFalse + } + } + + It 'adds single Name when only one is provided' { + InModuleScope PureStorageFlashBladePowerShell -Parameters @{ + Into = @{} + BoundParameters = @{} + Names = @('fs1') + } { + param($Into, $BoundParameters, $Names) + Add-PfbCommonQueryParams -Into $Into -BoundParameters $BoundParameters -Names $Names + $Into.ContainsKey('names') | Should -BeTrue + $Into['names'] | Should -Be 'fs1' + } + } + } + + Context 'Ids parameter' { + It 'adds ids joined by comma when Ids are provided' { + InModuleScope PureStorageFlashBladePowerShell -Parameters @{ + Into = @{} + BoundParameters = @{} + Ids = @('id1', 'id2', 'id3') + } { + param($Into, $BoundParameters, $Ids) + Add-PfbCommonQueryParams -Into $Into -BoundParameters $BoundParameters -Ids $Ids + $Into.ContainsKey('ids') | Should -BeTrue + $Into['ids'] | Should -Be 'id1,id2,id3' + } + } + + It 'does not add ids when Ids are not provided' { + InModuleScope PureStorageFlashBladePowerShell -Parameters @{ + Into = @{} + BoundParameters = @{} + } { + param($Into, $BoundParameters) + Add-PfbCommonQueryParams -Into $Into -BoundParameters $BoundParameters + $Into.ContainsKey('ids') | Should -BeFalse + } + } + + It 'does not add ids when Ids is an empty array' { + InModuleScope PureStorageFlashBladePowerShell -Parameters @{ + Into = @{} + BoundParameters = @{} + Ids = @() + } { + param($Into, $BoundParameters, $Ids) + Add-PfbCommonQueryParams -Into $Into -BoundParameters $BoundParameters -Ids $Ids + $Into.ContainsKey('ids') | Should -BeFalse + } + } + + It 'adds single Id when only one is provided' { + InModuleScope PureStorageFlashBladePowerShell -Parameters @{ + Into = @{} + BoundParameters = @{} + Ids = @('id1') + } { + param($Into, $BoundParameters, $Ids) + Add-PfbCommonQueryParams -Into $Into -BoundParameters $BoundParameters -Ids $Ids + $Into.ContainsKey('ids') | Should -BeTrue + $Into['ids'] | Should -Be 'id1' + } + } + } + + Context 'Names and Ids independence' { + It 'adds only Names when only Names are provided' { + InModuleScope PureStorageFlashBladePowerShell -Parameters @{ + Into = @{} + BoundParameters = @{} + Names = @('fs1', 'fs2') + } { + param($Into, $BoundParameters, $Names) + Add-PfbCommonQueryParams -Into $Into -BoundParameters $BoundParameters -Names $Names + $Into.ContainsKey('names') | Should -BeTrue + $Into['names'] | Should -Be 'fs1,fs2' + $Into.ContainsKey('ids') | Should -BeFalse + } + } + + It 'adds only Ids when only Ids are provided' { + InModuleScope PureStorageFlashBladePowerShell -Parameters @{ + Into = @{} + BoundParameters = @{} + Ids = @('id1', 'id2') + } { + param($Into, $BoundParameters, $Ids) + Add-PfbCommonQueryParams -Into $Into -BoundParameters $BoundParameters -Ids $Ids + $Into.ContainsKey('ids') | Should -BeTrue + $Into['ids'] | Should -Be 'id1,id2' + $Into.ContainsKey('names') | Should -BeFalse + } + } + + It 'adds both Names and Ids when both are provided' { + InModuleScope PureStorageFlashBladePowerShell -Parameters @{ + Into = @{} + BoundParameters = @{} + Names = @('fs1', 'fs2') + Ids = @('id1', 'id2') + } { + param($Into, $BoundParameters, $Names, $Ids) + Add-PfbCommonQueryParams -Into $Into -BoundParameters $BoundParameters -Names $Names -Ids $Ids + $Into.ContainsKey('names') | Should -BeTrue + $Into['names'] | Should -Be 'fs1,fs2' + $Into.ContainsKey('ids') | Should -BeTrue + $Into['ids'] | Should -Be 'id1,id2' + } + } + } + + Context 'In-place mutation' { + It 'mutates the $Into hashtable in place' { + InModuleScope PureStorageFlashBladePowerShell -Parameters @{ + Into = @{ existing_key = 'existing_value' } + BoundParameters = @{ Filter = 'test'; Limit = 50 } + Names = @('name1') + } { + param($Into, $BoundParameters, $Names) + Add-PfbCommonQueryParams -Into $Into -BoundParameters $BoundParameters -Names $Names + # Verify original key is still there + $Into['existing_key'] | Should -Be 'existing_value' + # Verify new keys were added + $Into['filter'] | Should -Be 'test' + $Into['limit'] | Should -Be 50 + $Into['names'] | Should -Be 'name1' + } + } + + It 'function returns nothing (hashtable is mutated, not returned)' { + InModuleScope PureStorageFlashBladePowerShell -Parameters @{ + Into = @{} + BoundParameters = @{ Filter = 'test' } + } { + param($Into, $BoundParameters) + $result = Add-PfbCommonQueryParams -Into $Into -BoundParameters $BoundParameters + $result | Should -BeNullOrEmpty + } + } + } + + Context 'All parameters together' { + It 'handles all four scalar parameters and both array parameters in one call' { + InModuleScope PureStorageFlashBladePowerShell -Parameters @{ + Into = @{} + BoundParameters = @{ Filter = 'name=test'; Sort = 'name'; Limit = 25; TotalOnly = $true } + Names = @('fs1', 'fs2') + Ids = @('id1') + } { + param($Into, $BoundParameters, $Names, $Ids) + Add-PfbCommonQueryParams -Into $Into -BoundParameters $BoundParameters -Names $Names -Ids $Ids + $Into['filter'] | Should -Be 'name=test' + $Into['sort'] | Should -Be 'name' + $Into['limit'] | Should -Be 25 + $Into['total_only'] | Should -Be 'true' + $Into['names'] | Should -Be 'fs1,fs2' + $Into['ids'] | Should -Be 'id1' + } + } + } +} From 21162704d20146d36244adad86f84fc9fa4f8b89 Mon Sep 17 00:00:00 2001 From: Justin Emerson Date: Thu, 23 Jul 2026 14:27:54 -0700 Subject: [PATCH 2/8] Migrate Bucket cmdlets to Add-PfbCommonQueryParams helper (#32) Replace the hand-rolled filter/sort/limit/total_only/names/ids mapping in Get-PfbBucket, Get-PfbBucketPerformance, and Get-PfbBucketS3Performance with the shared Add-PfbCommonQueryParams helper introduced in Task 1. Cmdlet-specific query params (-Destroyed, -StartTime/-EndTime/-Resolution) are left untouched. --- Public/Bucket/Get-PfbBucket.ps1 | 7 +------ Public/Bucket/Get-PfbBucketPerformance.ps1 | 7 +------ Public/Bucket/Get-PfbBucketS3Performance.ps1 | 7 +------ 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/Public/Bucket/Get-PfbBucket.ps1 b/Public/Bucket/Get-PfbBucket.ps1 index 5ae1eb6..1d17945 100644 --- a/Public/Bucket/Get-PfbBucket.ps1 +++ b/Public/Bucket/Get-PfbBucket.ps1 @@ -65,12 +65,7 @@ function Get-PfbBucket { end { $queryParams = @{} - if ($allNames.Count -gt 0) { $queryParams['names'] = $allNames -join ',' } - if ($allIds.Count -gt 0) { $queryParams['ids'] = $allIds -join ',' } - if ($Filter) { $queryParams['filter'] = $Filter } - if ($Sort) { $queryParams['sort'] = $Sort } - if ($Limit -gt 0) { $queryParams['limit'] = $Limit } - if ($TotalOnly) { $queryParams['total_only'] = 'true' } + Add-PfbCommonQueryParams -Into $queryParams -BoundParameters $PSBoundParameters -Names $allNames -Ids $allIds if ($Destroyed) { $queryParams['destroyed'] = 'true' } Invoke-PfbApiRequest -Array $Array -Method GET -Endpoint 'buckets' -QueryParams $queryParams -AutoPaginate diff --git a/Public/Bucket/Get-PfbBucketPerformance.ps1 b/Public/Bucket/Get-PfbBucketPerformance.ps1 index 5f13740..27f1b1b 100644 --- a/Public/Bucket/Get-PfbBucketPerformance.ps1 +++ b/Public/Bucket/Get-PfbBucketPerformance.ps1 @@ -66,15 +66,10 @@ function Get-PfbBucketPerformance { end { $queryParams = @{} - if ($allNames.Count -gt 0) { $queryParams['names'] = $allNames -join ',' } - if ($allIds.Count -gt 0) { $queryParams['ids'] = $allIds -join ',' } - if ($Filter) { $queryParams['filter'] = $Filter } - if ($Sort) { $queryParams['sort'] = $Sort } - if ($Limit -gt 0) { $queryParams['limit'] = $Limit } + Add-PfbCommonQueryParams -Into $queryParams -BoundParameters $PSBoundParameters -Names $allNames -Ids $allIds if ($StartTime) { $queryParams['start_time'] = $StartTime } if ($EndTime) { $queryParams['end_time'] = $EndTime } if ($Resolution) { $queryParams['resolution'] = $Resolution } - if ($TotalOnly) { $queryParams['total_only'] = 'true' } Invoke-PfbApiRequest -Array $Array -Method GET -Endpoint 'buckets/performance' -QueryParams $queryParams -AutoPaginate } diff --git a/Public/Bucket/Get-PfbBucketS3Performance.ps1 b/Public/Bucket/Get-PfbBucketS3Performance.ps1 index cb7f874..a551f9a 100644 --- a/Public/Bucket/Get-PfbBucketS3Performance.ps1 +++ b/Public/Bucket/Get-PfbBucketS3Performance.ps1 @@ -67,15 +67,10 @@ function Get-PfbBucketS3Performance { end { $queryParams = @{} - if ($allNames.Count -gt 0) { $queryParams['names'] = $allNames -join ',' } - if ($allIds.Count -gt 0) { $queryParams['ids'] = $allIds -join ',' } - if ($Filter) { $queryParams['filter'] = $Filter } - if ($Sort) { $queryParams['sort'] = $Sort } - if ($Limit -gt 0) { $queryParams['limit'] = $Limit } + Add-PfbCommonQueryParams -Into $queryParams -BoundParameters $PSBoundParameters -Names $allNames -Ids $allIds if ($StartTime) { $queryParams['start_time'] = $StartTime } if ($EndTime) { $queryParams['end_time'] = $EndTime } if ($Resolution) { $queryParams['resolution'] = $Resolution } - if ($TotalOnly) { $queryParams['total_only'] = 'true' } Invoke-PfbApiRequest -Array $Array -Method GET -Endpoint 'buckets/s3-specific-performance' -QueryParams $queryParams -AutoPaginate } From ca5bdded464d7a2139dadab5d98bfd443d5c5ece Mon Sep 17 00:00:00 2001 From: Justin Emerson Date: Thu, 23 Jul 2026 14:46:50 -0700 Subject: [PATCH 3/8] Migrate FileSystem cmdlets group A to Add-PfbCommonQueryParams Replace the hand-rolled filter/sort/limit/total_only/names/ids block in Get-PfbFileLock, Get-PfbFileLockClient, Get-PfbFileSystem, and Get-PfbFileSystemExport with the shared Add-PfbCommonQueryParams helper, matching the pattern already used by the Bucket cmdlets. Part of #32. --- Public/FileSystem/Get-PfbFileLock.ps1 | 7 +------ Public/FileSystem/Get-PfbFileLockClient.ps1 | 7 +------ Public/FileSystem/Get-PfbFileSystem.ps1 | 7 +------ Public/FileSystem/Get-PfbFileSystemExport.ps1 | 7 +------ 4 files changed, 4 insertions(+), 24 deletions(-) diff --git a/Public/FileSystem/Get-PfbFileLock.ps1 b/Public/FileSystem/Get-PfbFileLock.ps1 index f91f598..a36a25b 100644 --- a/Public/FileSystem/Get-PfbFileLock.ps1 +++ b/Public/FileSystem/Get-PfbFileLock.ps1 @@ -70,12 +70,7 @@ function Get-PfbFileLock { end { $queryParams = @{} - if ($allNames.Count -gt 0) { $queryParams['names'] = $allNames -join ',' } - if ($allIds.Count -gt 0) { $queryParams['ids'] = $allIds -join ',' } - if ($Filter) { $queryParams['filter'] = $Filter } - if ($Sort) { $queryParams['sort'] = $Sort } - if ($Limit -gt 0) { $queryParams['limit'] = $Limit } - if ($TotalOnly) { $queryParams['total_only'] = 'true' } + Add-PfbCommonQueryParams -Into $queryParams -BoundParameters $PSBoundParameters -Names $allNames -Ids $allIds Invoke-PfbApiRequest -Array $Array -Method GET -Endpoint 'file-systems/locks' -QueryParams $queryParams -AutoPaginate } diff --git a/Public/FileSystem/Get-PfbFileLockClient.ps1 b/Public/FileSystem/Get-PfbFileLockClient.ps1 index 6239145..19cc9bf 100644 --- a/Public/FileSystem/Get-PfbFileLockClient.ps1 +++ b/Public/FileSystem/Get-PfbFileLockClient.ps1 @@ -70,12 +70,7 @@ function Get-PfbFileLockClient { end { $queryParams = @{} - if ($allNames.Count -gt 0) { $queryParams['names'] = $allNames -join ',' } - if ($allIds.Count -gt 0) { $queryParams['ids'] = $allIds -join ',' } - if ($Filter) { $queryParams['filter'] = $Filter } - if ($Sort) { $queryParams['sort'] = $Sort } - if ($Limit -gt 0) { $queryParams['limit'] = $Limit } - if ($TotalOnly) { $queryParams['total_only'] = 'true' } + Add-PfbCommonQueryParams -Into $queryParams -BoundParameters $PSBoundParameters -Names $allNames -Ids $allIds Invoke-PfbApiRequest -Array $Array -Method GET -Endpoint 'file-systems/locks/clients' -QueryParams $queryParams -AutoPaginate } diff --git a/Public/FileSystem/Get-PfbFileSystem.ps1 b/Public/FileSystem/Get-PfbFileSystem.ps1 index fae391a..c52fe01 100644 --- a/Public/FileSystem/Get-PfbFileSystem.ps1 +++ b/Public/FileSystem/Get-PfbFileSystem.ps1 @@ -73,12 +73,7 @@ function Get-PfbFileSystem { end { $queryParams = @{} - if ($allNames.Count -gt 0) { $queryParams['names'] = $allNames -join ',' } - if ($allIds.Count -gt 0) { $queryParams['ids'] = $allIds -join ',' } - if ($Filter) { $queryParams['filter'] = $Filter } - if ($Sort) { $queryParams['sort'] = $Sort } - if ($Limit -gt 0) { $queryParams['limit'] = $Limit } - if ($TotalOnly) { $queryParams['total_only'] = 'true' } + Add-PfbCommonQueryParams -Into $queryParams -BoundParameters $PSBoundParameters -Names $allNames -Ids $allIds if ($Destroyed) { $queryParams['destroyed'] = 'true' } Invoke-PfbApiRequest -Array $Array -Method GET -Endpoint 'file-systems' -QueryParams $queryParams -AutoPaginate diff --git a/Public/FileSystem/Get-PfbFileSystemExport.ps1 b/Public/FileSystem/Get-PfbFileSystemExport.ps1 index cbf24a6..6611998 100644 --- a/Public/FileSystem/Get-PfbFileSystemExport.ps1 +++ b/Public/FileSystem/Get-PfbFileSystemExport.ps1 @@ -70,12 +70,7 @@ function Get-PfbFileSystemExport { end { $queryParams = @{} - if ($allNames.Count -gt 0) { $queryParams['names'] = $allNames -join ',' } - if ($allIds.Count -gt 0) { $queryParams['ids'] = $allIds -join ',' } - if ($Filter) { $queryParams['filter'] = $Filter } - if ($Sort) { $queryParams['sort'] = $Sort } - if ($Limit -gt 0) { $queryParams['limit'] = $Limit } - if ($TotalOnly) { $queryParams['total_only'] = 'true' } + Add-PfbCommonQueryParams -Into $queryParams -BoundParameters $PSBoundParameters -Names $allNames -Ids $allIds Invoke-PfbApiRequest -Array $Array -Method GET -Endpoint 'file-system-exports' -QueryParams $queryParams -AutoPaginate } From d361c128733b50859d61813ce2c78588c2dc45e3 Mon Sep 17 00:00:00 2001 From: Justin Emerson Date: Thu, 23 Jul 2026 15:00:10 -0700 Subject: [PATCH 4/8] Migrate FileSystem cmdlets group B to Add-PfbCommonQueryParams Replace the hand-rolled filter/sort/limit/total_only(/names/ids) block in Get-PfbFileSystemGroupPerformance, Get-PfbFileSystemSession, Get-PfbFileSystemStorageClass, Get-PfbFileSystemUserPerformance, and Get-PfbOpenFile with the shared Add-PfbCommonQueryParams helper. Get-PfbFileSystemGroupPerformance and Get-PfbFileSystemUserPerformance keep their file_system_names/file_system_ids query keys as cmdlet-specific lines (not routed through -Names/-Ids) since that differs from the generic names/ids convention the helper hardcodes. Part of #32. --- Public/FileSystem/Get-PfbFileSystemGroupPerformance.ps1 | 5 +---- Public/FileSystem/Get-PfbFileSystemSession.ps1 | 6 +----- Public/FileSystem/Get-PfbFileSystemStorageClass.ps1 | 7 +------ Public/FileSystem/Get-PfbFileSystemUserPerformance.ps1 | 5 +---- Public/FileSystem/Get-PfbOpenFile.ps1 | 7 +------ 5 files changed, 5 insertions(+), 25 deletions(-) diff --git a/Public/FileSystem/Get-PfbFileSystemGroupPerformance.ps1 b/Public/FileSystem/Get-PfbFileSystemGroupPerformance.ps1 index 70126a0..0786078 100644 --- a/Public/FileSystem/Get-PfbFileSystemGroupPerformance.ps1 +++ b/Public/FileSystem/Get-PfbFileSystemGroupPerformance.ps1 @@ -85,12 +85,9 @@ function Get-PfbFileSystemGroupPerformance { end { $queryParams = @{} + Add-PfbCommonQueryParams -Into $queryParams -BoundParameters $PSBoundParameters if ($allNames.Count -gt 0) { $queryParams['file_system_names'] = $allNames -join ',' } if ($allIds.Count -gt 0) { $queryParams['file_system_ids'] = $allIds -join ',' } - if ($Filter) { $queryParams['filter'] = $Filter } - if ($Sort) { $queryParams['sort'] = $Sort } - if ($Limit -gt 0) { $queryParams['limit'] = $Limit } - if ($TotalOnly) { $queryParams['total_only'] = 'true' } if ($StartTime -gt 0) { $queryParams['start_time'] = $StartTime } if ($EndTime -gt 0) { $queryParams['end_time'] = $EndTime } if ($Resolution -gt 0) { $queryParams['resolution'] = $Resolution } diff --git a/Public/FileSystem/Get-PfbFileSystemSession.ps1 b/Public/FileSystem/Get-PfbFileSystemSession.ps1 index 0c48f2c..015706e 100644 --- a/Public/FileSystem/Get-PfbFileSystemSession.ps1 +++ b/Public/FileSystem/Get-PfbFileSystemSession.ps1 @@ -71,11 +71,7 @@ function Get-PfbFileSystemSession { end { $queryParams = @{} - if ($allNames.Count -gt 0) { $queryParams['names'] = $allNames -join ',' } - if ($Filter) { $queryParams['filter'] = $Filter } - if ($Sort) { $queryParams['sort'] = $Sort } - if ($Limit -gt 0) { $queryParams['limit'] = $Limit } - if ($TotalOnly) { $queryParams['total_only'] = 'true' } + Add-PfbCommonQueryParams -Into $queryParams -BoundParameters $PSBoundParameters -Names $allNames if ($Protocol) { $queryParams['protocols'] = $Protocol -join ',' } Invoke-PfbApiRequest -Array $Array -Method GET -Endpoint 'file-systems/sessions' -QueryParams $queryParams -AutoPaginate diff --git a/Public/FileSystem/Get-PfbFileSystemStorageClass.ps1 b/Public/FileSystem/Get-PfbFileSystemStorageClass.ps1 index 7815e0a..795c297 100644 --- a/Public/FileSystem/Get-PfbFileSystemStorageClass.ps1 +++ b/Public/FileSystem/Get-PfbFileSystemStorageClass.ps1 @@ -70,12 +70,7 @@ function Get-PfbFileSystemStorageClass { end { $queryParams = @{} - if ($allNames.Count -gt 0) { $queryParams['names'] = $allNames -join ',' } - if ($allIds.Count -gt 0) { $queryParams['ids'] = $allIds -join ',' } - if ($Filter) { $queryParams['filter'] = $Filter } - if ($Sort) { $queryParams['sort'] = $Sort } - if ($Limit -gt 0) { $queryParams['limit'] = $Limit } - if ($TotalOnly) { $queryParams['total_only'] = 'true' } + Add-PfbCommonQueryParams -Into $queryParams -BoundParameters $PSBoundParameters -Names $allNames -Ids $allIds try { Invoke-PfbApiRequest -Array $Array -Method GET -Endpoint 'file-systems/space/storage-classes' -QueryParams $queryParams -AutoPaginate diff --git a/Public/FileSystem/Get-PfbFileSystemUserPerformance.ps1 b/Public/FileSystem/Get-PfbFileSystemUserPerformance.ps1 index f05f91a..6bba204 100644 --- a/Public/FileSystem/Get-PfbFileSystemUserPerformance.ps1 +++ b/Public/FileSystem/Get-PfbFileSystemUserPerformance.ps1 @@ -85,12 +85,9 @@ function Get-PfbFileSystemUserPerformance { end { $queryParams = @{} + Add-PfbCommonQueryParams -Into $queryParams -BoundParameters $PSBoundParameters if ($allNames.Count -gt 0) { $queryParams['file_system_names'] = $allNames -join ',' } if ($allIds.Count -gt 0) { $queryParams['file_system_ids'] = $allIds -join ',' } - if ($Filter) { $queryParams['filter'] = $Filter } - if ($Sort) { $queryParams['sort'] = $Sort } - if ($Limit -gt 0) { $queryParams['limit'] = $Limit } - if ($TotalOnly) { $queryParams['total_only'] = 'true' } if ($StartTime -gt 0) { $queryParams['start_time'] = $StartTime } if ($EndTime -gt 0) { $queryParams['end_time'] = $EndTime } if ($Resolution -gt 0) { $queryParams['resolution'] = $Resolution } diff --git a/Public/FileSystem/Get-PfbOpenFile.ps1 b/Public/FileSystem/Get-PfbOpenFile.ps1 index 3e27b53..cf2ead0 100644 --- a/Public/FileSystem/Get-PfbOpenFile.ps1 +++ b/Public/FileSystem/Get-PfbOpenFile.ps1 @@ -70,12 +70,7 @@ function Get-PfbOpenFile { end { $queryParams = @{} - if ($allNames.Count -gt 0) { $queryParams['names'] = $allNames -join ',' } - if ($allIds.Count -gt 0) { $queryParams['ids'] = $allIds -join ',' } - if ($Filter) { $queryParams['filter'] = $Filter } - if ($Sort) { $queryParams['sort'] = $Sort } - if ($Limit -gt 0) { $queryParams['limit'] = $Limit } - if ($TotalOnly) { $queryParams['total_only'] = 'true' } + Add-PfbCommonQueryParams -Into $queryParams -BoundParameters $PSBoundParameters -Names $allNames -Ids $allIds Invoke-PfbApiRequest -Array $Array -Method GET -Endpoint 'file-systems/open-files' -QueryParams $queryParams -AutoPaginate } From 4cb70e382172c6af924b851f9bb391d93f3f5dae Mon Sep 17 00:00:00 2001 From: Justin Emerson Date: Thu, 23 Jul 2026 15:11:32 -0700 Subject: [PATCH 5/8] Migrate FileSystemSnapshot + Replication cmdlets to Add-PfbCommonQueryParams (#32) Replaces the hand-rolled filter/sort/limit/total_only/names/ids query-param blocks in Get-PfbFileSystemSnapshot, Get-PfbFileSystemSnapshotTransfer, and Get-PfbFileSystemReplicaLinkTransfer with calls to the shared helper. All three use the generic names/ids wire keys, so no cmdlet-specific naming divergence applies here. --- Public/FileSystemSnapshot/Get-PfbFileSystemSnapshot.ps1 | 7 +------ .../Get-PfbFileSystemSnapshotTransfer.ps1 | 7 +------ .../Replication/Get-PfbFileSystemReplicaLinkTransfer.ps1 | 7 +------ 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/Public/FileSystemSnapshot/Get-PfbFileSystemSnapshot.ps1 b/Public/FileSystemSnapshot/Get-PfbFileSystemSnapshot.ps1 index 9abe705..337ce05 100644 --- a/Public/FileSystemSnapshot/Get-PfbFileSystemSnapshot.ps1 +++ b/Public/FileSystemSnapshot/Get-PfbFileSystemSnapshot.ps1 @@ -68,13 +68,8 @@ function Get-PfbFileSystemSnapshot { end { $queryParams = @{} - if ($allNames.Count -gt 0) { $queryParams['names'] = $allNames -join ',' } - if ($allIds.Count -gt 0) { $queryParams['ids'] = $allIds -join ',' } + Add-PfbCommonQueryParams -Into $queryParams -BoundParameters $PSBoundParameters -Names $allNames -Ids $allIds if ($SourceName) { $queryParams['source_names'] = $SourceName } - if ($Filter) { $queryParams['filter'] = $Filter } - if ($Sort) { $queryParams['sort'] = $Sort } - if ($Limit -gt 0) { $queryParams['limit'] = $Limit } - if ($TotalOnly) { $queryParams['total_only'] = 'true' } if ($Destroyed) { $queryParams['destroyed'] = 'true' } Invoke-PfbApiRequest -Array $Array -Method GET -Endpoint 'file-system-snapshots' -QueryParams $queryParams -AutoPaginate diff --git a/Public/FileSystemSnapshot/Get-PfbFileSystemSnapshotTransfer.ps1 b/Public/FileSystemSnapshot/Get-PfbFileSystemSnapshotTransfer.ps1 index e4ef94d..7b09e7c 100644 --- a/Public/FileSystemSnapshot/Get-PfbFileSystemSnapshotTransfer.ps1 +++ b/Public/FileSystemSnapshot/Get-PfbFileSystemSnapshotTransfer.ps1 @@ -66,12 +66,7 @@ function Get-PfbFileSystemSnapshotTransfer { end { $queryParams = @{} - if ($allNames.Count -gt 0) { $queryParams['names'] = $allNames -join ',' } - if ($allIds.Count -gt 0) { $queryParams['ids'] = $allIds -join ',' } - if ($Filter) { $queryParams['filter'] = $Filter } - if ($Sort) { $queryParams['sort'] = $Sort } - if ($Limit -gt 0) { $queryParams['limit'] = $Limit } - if ($TotalOnly) { $queryParams['total_only'] = 'true' } + Add-PfbCommonQueryParams -Into $queryParams -BoundParameters $PSBoundParameters -Names $allNames -Ids $allIds Invoke-PfbApiRequest -Array $Array -Method GET -Endpoint 'file-system-snapshots/transfer' -QueryParams $queryParams -AutoPaginate } diff --git a/Public/Replication/Get-PfbFileSystemReplicaLinkTransfer.ps1 b/Public/Replication/Get-PfbFileSystemReplicaLinkTransfer.ps1 index 9c4dad3..9b4d043 100644 --- a/Public/Replication/Get-PfbFileSystemReplicaLinkTransfer.ps1 +++ b/Public/Replication/Get-PfbFileSystemReplicaLinkTransfer.ps1 @@ -70,12 +70,7 @@ function Get-PfbFileSystemReplicaLinkTransfer { end { $queryParams = @{} - if ($allNames.Count -gt 0) { $queryParams['names'] = $allNames -join ',' } - if ($allIds.Count -gt 0) { $queryParams['ids'] = $allIds -join ',' } - if ($Filter) { $queryParams['filter'] = $Filter } - if ($Sort) { $queryParams['sort'] = $Sort } - if ($Limit -gt 0) { $queryParams['limit'] = $Limit } - if ($TotalOnly) { $queryParams['total_only'] = 'true' } + Add-PfbCommonQueryParams -Into $queryParams -BoundParameters $PSBoundParameters -Names $allNames -Ids $allIds Invoke-PfbApiRequest -Array $Array -Method GET -Endpoint 'file-system-replica-links/transfer' -QueryParams $queryParams -AutoPaginate } From df681a3b917d8f92bb158fee40a830c289080852 Mon Sep 17 00:00:00 2001 From: Justin Emerson Date: Thu, 23 Jul 2026 15:24:57 -0700 Subject: [PATCH 6/8] Migrate ObjectStore cmdlets group A to Add-PfbCommonQueryParams (#32) Replaces the hand-rolled filter/sort/limit/total_only query-param blocks in Get-PfbObjectStoreAccessPolicy(Action|Role|Rule|User) with calls to the shared Add-PfbCommonQueryParams helper. Get-PfbObjectStoreAccessPolicyRole and -User use non-generic policy_names/policy_ids/member_names/member_ids wire keys, so the helper is called without -Names/-Ids there; Rule mixes a generic 'names' key (from -Name) with non-generic policy_names/policy_ids (from -PolicyName/-PolicyId), so only -Names is passed through. Co-Authored-By: Claude Sonnet 5 --- Public/ObjectStore/Get-PfbObjectStoreAccessPolicy.ps1 | 7 +------ .../ObjectStore/Get-PfbObjectStoreAccessPolicyAction.ps1 | 5 +---- Public/ObjectStore/Get-PfbObjectStoreAccessPolicyRole.ps1 | 5 +---- Public/ObjectStore/Get-PfbObjectStoreAccessPolicyRule.ps1 | 6 +----- Public/ObjectStore/Get-PfbObjectStoreAccessPolicyUser.ps1 | 5 +---- 5 files changed, 5 insertions(+), 23 deletions(-) diff --git a/Public/ObjectStore/Get-PfbObjectStoreAccessPolicy.ps1 b/Public/ObjectStore/Get-PfbObjectStoreAccessPolicy.ps1 index af9e405..be43a84 100644 --- a/Public/ObjectStore/Get-PfbObjectStoreAccessPolicy.ps1 +++ b/Public/ObjectStore/Get-PfbObjectStoreAccessPolicy.ps1 @@ -58,12 +58,7 @@ function Get-PfbObjectStoreAccessPolicy { end { $queryParams = @{} - if ($allNames.Count -gt 0) { $queryParams['names'] = $allNames -join ',' } - if ($allIds.Count -gt 0) { $queryParams['ids'] = $allIds -join ',' } - if ($Filter) { $queryParams['filter'] = $Filter } - if ($Sort) { $queryParams['sort'] = $Sort } - if ($Limit -gt 0) { $queryParams['limit'] = $Limit } - if ($TotalOnly) { $queryParams['total_only'] = 'true' } + Add-PfbCommonQueryParams -Into $queryParams -BoundParameters $PSBoundParameters -Names $allNames -Ids $allIds Invoke-PfbApiRequest -Array $Array -Method GET -Endpoint 'object-store-access-policies' -QueryParams $queryParams -AutoPaginate } diff --git a/Public/ObjectStore/Get-PfbObjectStoreAccessPolicyAction.ps1 b/Public/ObjectStore/Get-PfbObjectStoreAccessPolicyAction.ps1 index 3e77670..5c66e3f 100644 --- a/Public/ObjectStore/Get-PfbObjectStoreAccessPolicyAction.ps1 +++ b/Public/ObjectStore/Get-PfbObjectStoreAccessPolicyAction.ps1 @@ -38,10 +38,7 @@ function Get-PfbObjectStoreAccessPolicyAction { Assert-PfbConnection -Array ([ref]$Array) $queryParams = @{} - if ($Filter) { $queryParams['filter'] = $Filter } - if ($Sort) { $queryParams['sort'] = $Sort } - if ($Limit -gt 0) { $queryParams['limit'] = $Limit } - if ($TotalOnly) { $queryParams['total_only'] = 'true' } + Add-PfbCommonQueryParams -Into $queryParams -BoundParameters $PSBoundParameters Invoke-PfbApiRequest -Array $Array -Method GET -Endpoint 'object-store-access-policy-actions' -QueryParams $queryParams -AutoPaginate } diff --git a/Public/ObjectStore/Get-PfbObjectStoreAccessPolicyRole.ps1 b/Public/ObjectStore/Get-PfbObjectStoreAccessPolicyRole.ps1 index 10c7094..f6f4e09 100644 --- a/Public/ObjectStore/Get-PfbObjectStoreAccessPolicyRole.ps1 +++ b/Public/ObjectStore/Get-PfbObjectStoreAccessPolicyRole.ps1 @@ -72,14 +72,11 @@ function Get-PfbObjectStoreAccessPolicyRole { end { $queryParams = @{} + Add-PfbCommonQueryParams -Into $queryParams -BoundParameters $PSBoundParameters if ($allPolicyNames.Count -gt 0) { $queryParams['policy_names'] = $allPolicyNames -join ',' } if ($allPolicyIds.Count -gt 0) { $queryParams['policy_ids'] = $allPolicyIds -join ',' } if ($allMemberNames.Count -gt 0) { $queryParams['member_names'] = $allMemberNames -join ',' } if ($allMemberIds.Count -gt 0) { $queryParams['member_ids'] = $allMemberIds -join ',' } - if ($Filter) { $queryParams['filter'] = $Filter } - if ($Sort) { $queryParams['sort'] = $Sort } - if ($Limit -gt 0) { $queryParams['limit'] = $Limit } - if ($TotalOnly) { $queryParams['total_only'] = 'true' } $response = Invoke-PfbApiRequest -Array $Array -Method GET -Endpoint 'object-store-access-policies/object-store-roles' -QueryParams $queryParams -AutoPaginate foreach ($item in $response) { diff --git a/Public/ObjectStore/Get-PfbObjectStoreAccessPolicyRule.ps1 b/Public/ObjectStore/Get-PfbObjectStoreAccessPolicyRule.ps1 index 1b0b682..fe61cba 100644 --- a/Public/ObjectStore/Get-PfbObjectStoreAccessPolicyRule.ps1 +++ b/Public/ObjectStore/Get-PfbObjectStoreAccessPolicyRule.ps1 @@ -65,13 +65,9 @@ function Get-PfbObjectStoreAccessPolicyRule { end { $queryParams = @{} + Add-PfbCommonQueryParams -Into $queryParams -BoundParameters $PSBoundParameters -Names $allNames if ($allPolicyNames.Count -gt 0) { $queryParams['policy_names'] = $allPolicyNames -join ',' } if ($allPolicyIds.Count -gt 0) { $queryParams['policy_ids'] = $allPolicyIds -join ',' } - if ($allNames.Count -gt 0) { $queryParams['names'] = $allNames -join ',' } - if ($Filter) { $queryParams['filter'] = $Filter } - if ($Sort) { $queryParams['sort'] = $Sort } - if ($Limit -gt 0) { $queryParams['limit'] = $Limit } - if ($TotalOnly) { $queryParams['total_only'] = 'true' } Invoke-PfbApiRequest -Array $Array -Method GET -Endpoint 'object-store-access-policies/rules' -QueryParams $queryParams -AutoPaginate } diff --git a/Public/ObjectStore/Get-PfbObjectStoreAccessPolicyUser.ps1 b/Public/ObjectStore/Get-PfbObjectStoreAccessPolicyUser.ps1 index 00617af..46dce90 100644 --- a/Public/ObjectStore/Get-PfbObjectStoreAccessPolicyUser.ps1 +++ b/Public/ObjectStore/Get-PfbObjectStoreAccessPolicyUser.ps1 @@ -72,14 +72,11 @@ function Get-PfbObjectStoreAccessPolicyUser { end { $queryParams = @{} + Add-PfbCommonQueryParams -Into $queryParams -BoundParameters $PSBoundParameters if ($allPolicyNames.Count -gt 0) { $queryParams['policy_names'] = $allPolicyNames -join ',' } if ($allPolicyIds.Count -gt 0) { $queryParams['policy_ids'] = $allPolicyIds -join ',' } if ($allMemberNames.Count -gt 0) { $queryParams['member_names'] = $allMemberNames -join ',' } if ($allMemberIds.Count -gt 0) { $queryParams['member_ids'] = $allMemberIds -join ',' } - if ($Filter) { $queryParams['filter'] = $Filter } - if ($Sort) { $queryParams['sort'] = $Sort } - if ($Limit -gt 0) { $queryParams['limit'] = $Limit } - if ($TotalOnly) { $queryParams['total_only'] = 'true' } $response = Invoke-PfbApiRequest -Array $Array -Method GET -Endpoint 'object-store-access-policies/object-store-users' -QueryParams $queryParams -AutoPaginate foreach ($item in $response) { From da1890e14d5429968ff24230907de9341c6c7d4e Mon Sep 17 00:00:00 2001 From: Justin Emerson Date: Thu, 23 Jul 2026 15:35:50 -0700 Subject: [PATCH 7/8] Migrate ObjectStore cmdlets group B to Add-PfbCommonQueryParams (#32) Get-PfbObjectStoreAccount, Get-PfbObjectStoreAccountExport, Get-PfbObjectStoreRemoteCredential, and Get-PfbObjectStoreRole use generic names/ids wire keys, so their end{} blocks now route -Names/-Ids through the shared helper. Get-PfbObjectStoreRoleAccessPolicy maps its Role/Member name and id params to non-generic role_names/role_ids/member_names/member_ids wire keys, so the helper is called without -Names/-Ids and those four lines are left as the cmdlet's own untouched query-param assignments. --- Public/ObjectStore/Get-PfbObjectStoreAccount.ps1 | 7 +------ Public/ObjectStore/Get-PfbObjectStoreAccountExport.ps1 | 7 +------ Public/ObjectStore/Get-PfbObjectStoreRemoteCredential.ps1 | 7 +------ Public/ObjectStore/Get-PfbObjectStoreRole.ps1 | 7 +------ Public/ObjectStore/Get-PfbObjectStoreRoleAccessPolicy.ps1 | 5 +---- 5 files changed, 5 insertions(+), 28 deletions(-) diff --git a/Public/ObjectStore/Get-PfbObjectStoreAccount.ps1 b/Public/ObjectStore/Get-PfbObjectStoreAccount.ps1 index 21f3a53..2f0f930 100644 --- a/Public/ObjectStore/Get-PfbObjectStoreAccount.ps1 +++ b/Public/ObjectStore/Get-PfbObjectStoreAccount.ps1 @@ -47,12 +47,7 @@ function Get-PfbObjectStoreAccount { end { $queryParams = @{} - if ($allNames.Count -gt 0) { $queryParams['names'] = $allNames -join ',' } - if ($allIds.Count -gt 0) { $queryParams['ids'] = $allIds -join ',' } - if ($Filter) { $queryParams['filter'] = $Filter } - if ($Sort) { $queryParams['sort'] = $Sort } - if ($Limit -gt 0) { $queryParams['limit'] = $Limit } - if ($TotalOnly) { $queryParams['total_only'] = 'true' } + Add-PfbCommonQueryParams -Into $queryParams -BoundParameters $PSBoundParameters -Names $allNames -Ids $allIds Invoke-PfbApiRequest -Array $Array -Method GET -Endpoint 'object-store-accounts' -QueryParams $queryParams -AutoPaginate } diff --git a/Public/ObjectStore/Get-PfbObjectStoreAccountExport.ps1 b/Public/ObjectStore/Get-PfbObjectStoreAccountExport.ps1 index 7f08f88..bd56541 100644 --- a/Public/ObjectStore/Get-PfbObjectStoreAccountExport.ps1 +++ b/Public/ObjectStore/Get-PfbObjectStoreAccountExport.ps1 @@ -57,12 +57,7 @@ function Get-PfbObjectStoreAccountExport { end { $queryParams = @{} - if ($allNames.Count -gt 0) { $queryParams['names'] = $allNames -join ',' } - if ($allIds.Count -gt 0) { $queryParams['ids'] = $allIds -join ',' } - if ($Filter) { $queryParams['filter'] = $Filter } - if ($Sort) { $queryParams['sort'] = $Sort } - if ($Limit -gt 0) { $queryParams['limit'] = $Limit } - if ($TotalOnly) { $queryParams['total_only'] = 'true' } + Add-PfbCommonQueryParams -Into $queryParams -BoundParameters $PSBoundParameters -Names $allNames -Ids $allIds Invoke-PfbApiRequest -Array $Array -Method GET -Endpoint 'object-store-account-exports' -QueryParams $queryParams -AutoPaginate } diff --git a/Public/ObjectStore/Get-PfbObjectStoreRemoteCredential.ps1 b/Public/ObjectStore/Get-PfbObjectStoreRemoteCredential.ps1 index bc08bf4..9865d5b 100644 --- a/Public/ObjectStore/Get-PfbObjectStoreRemoteCredential.ps1 +++ b/Public/ObjectStore/Get-PfbObjectStoreRemoteCredential.ps1 @@ -58,12 +58,7 @@ function Get-PfbObjectStoreRemoteCredential { end { $queryParams = @{} - if ($allNames.Count -gt 0) { $queryParams['names'] = $allNames -join ',' } - if ($allIds.Count -gt 0) { $queryParams['ids'] = $allIds -join ',' } - if ($Filter) { $queryParams['filter'] = $Filter } - if ($Sort) { $queryParams['sort'] = $Sort } - if ($Limit -gt 0) { $queryParams['limit'] = $Limit } - if ($TotalOnly) { $queryParams['total_only'] = 'true' } + Add-PfbCommonQueryParams -Into $queryParams -BoundParameters $PSBoundParameters -Names $allNames -Ids $allIds Invoke-PfbApiRequest -Array $Array -Method GET -Endpoint 'object-store-remote-credentials' -QueryParams $queryParams -AutoPaginate } diff --git a/Public/ObjectStore/Get-PfbObjectStoreRole.ps1 b/Public/ObjectStore/Get-PfbObjectStoreRole.ps1 index c3213b9..cdc6f38 100644 --- a/Public/ObjectStore/Get-PfbObjectStoreRole.ps1 +++ b/Public/ObjectStore/Get-PfbObjectStoreRole.ps1 @@ -58,12 +58,7 @@ function Get-PfbObjectStoreRole { end { $queryParams = @{} - if ($allNames.Count -gt 0) { $queryParams['names'] = $allNames -join ',' } - if ($allIds.Count -gt 0) { $queryParams['ids'] = $allIds -join ',' } - if ($Filter) { $queryParams['filter'] = $Filter } - if ($Sort) { $queryParams['sort'] = $Sort } - if ($Limit -gt 0) { $queryParams['limit'] = $Limit } - if ($TotalOnly) { $queryParams['total_only'] = 'true' } + Add-PfbCommonQueryParams -Into $queryParams -BoundParameters $PSBoundParameters -Names $allNames -Ids $allIds Invoke-PfbApiRequest -Array $Array -Method GET -Endpoint 'object-store-roles' -QueryParams $queryParams -AutoPaginate } diff --git a/Public/ObjectStore/Get-PfbObjectStoreRoleAccessPolicy.ps1 b/Public/ObjectStore/Get-PfbObjectStoreRoleAccessPolicy.ps1 index 3086620..ba5fec1 100644 --- a/Public/ObjectStore/Get-PfbObjectStoreRoleAccessPolicy.ps1 +++ b/Public/ObjectStore/Get-PfbObjectStoreRoleAccessPolicy.ps1 @@ -72,14 +72,11 @@ function Get-PfbObjectStoreRoleAccessPolicy { end { $queryParams = @{} + Add-PfbCommonQueryParams -Into $queryParams -BoundParameters $PSBoundParameters if ($allRoleNames.Count -gt 0) { $queryParams['role_names'] = $allRoleNames -join ',' } if ($allRoleIds.Count -gt 0) { $queryParams['role_ids'] = $allRoleIds -join ',' } if ($allMemberNames.Count -gt 0) { $queryParams['member_names'] = $allMemberNames -join ',' } if ($allMemberIds.Count -gt 0) { $queryParams['member_ids'] = $allMemberIds -join ',' } - if ($Filter) { $queryParams['filter'] = $Filter } - if ($Sort) { $queryParams['sort'] = $Sort } - if ($Limit -gt 0) { $queryParams['limit'] = $Limit } - if ($TotalOnly) { $queryParams['total_only'] = 'true' } Invoke-PfbApiRequest -Array $Array -Method GET -Endpoint 'object-store-roles/object-store-access-policies' -QueryParams $queryParams -AutoPaginate } From c3f9c363c33e81591ada1b80dd63e4460534d17c Mon Sep 17 00:00:00 2001 From: Justin Emerson Date: Thu, 23 Jul 2026 15:48:01 -0700 Subject: [PATCH 8/8] Migrate ObjectStore group C + Realm + Server cmdlets to Add-PfbCommonQueryParams (#32) Final migration batch: Get-PfbObjectStoreTrustPolicy, Get-PfbObjectStoreTrustPolicyRule, Get-PfbObjectStoreUserAccessPolicy, Get-PfbRealm, and Get-PfbServer now route their Filter/Sort/Limit/TotalOnly (and generic Names/Ids where applicable) query-param assembly through the shared helper, matching the prior 25-cmdlet migration. Completeness sweep confirms all 30 originally-identified Get-Pfb* cmdlets now call Add-PfbCommonQueryParams, with no hand-rolled total_only assignments remaining outside Private/Add-PfbCommonQueryParams.ps1. --- Public/ObjectStore/Get-PfbObjectStoreTrustPolicy.ps1 | 5 +---- Public/ObjectStore/Get-PfbObjectStoreTrustPolicyRule.ps1 | 6 +----- Public/ObjectStore/Get-PfbObjectStoreUserAccessPolicy.ps1 | 5 +---- Public/Realm/Get-PfbRealm.ps1 | 7 +------ Public/Server/Get-PfbServer.ps1 | 7 +------ 5 files changed, 5 insertions(+), 25 deletions(-) diff --git a/Public/ObjectStore/Get-PfbObjectStoreTrustPolicy.ps1 b/Public/ObjectStore/Get-PfbObjectStoreTrustPolicy.ps1 index eeae729..2790683 100644 --- a/Public/ObjectStore/Get-PfbObjectStoreTrustPolicy.ps1 +++ b/Public/ObjectStore/Get-PfbObjectStoreTrustPolicy.ps1 @@ -58,12 +58,9 @@ function Get-PfbObjectStoreTrustPolicy { end { $queryParams = @{} + Add-PfbCommonQueryParams -Into $queryParams -BoundParameters $PSBoundParameters if ($allRoleNames.Count -gt 0) { $queryParams['role_names'] = $allRoleNames -join ',' } if ($allRoleIds.Count -gt 0) { $queryParams['role_ids'] = $allRoleIds -join ',' } - if ($Filter) { $queryParams['filter'] = $Filter } - if ($Sort) { $queryParams['sort'] = $Sort } - if ($Limit -gt 0) { $queryParams['limit'] = $Limit } - if ($TotalOnly) { $queryParams['total_only'] = 'true' } Invoke-PfbApiRequest -Array $Array -Method GET -Endpoint 'object-store-roles/object-store-trust-policies' -QueryParams $queryParams -AutoPaginate } diff --git a/Public/ObjectStore/Get-PfbObjectStoreTrustPolicyRule.ps1 b/Public/ObjectStore/Get-PfbObjectStoreTrustPolicyRule.ps1 index e3999db..622678c 100644 --- a/Public/ObjectStore/Get-PfbObjectStoreTrustPolicyRule.ps1 +++ b/Public/ObjectStore/Get-PfbObjectStoreTrustPolicyRule.ps1 @@ -65,13 +65,9 @@ function Get-PfbObjectStoreTrustPolicyRule { end { $queryParams = @{} + Add-PfbCommonQueryParams -Into $queryParams -BoundParameters $PSBoundParameters -Names $allNames if ($allPolicyNames.Count -gt 0) { $queryParams['policy_names'] = $allPolicyNames -join ',' } if ($allPolicyIds.Count -gt 0) { $queryParams['policy_ids'] = $allPolicyIds -join ',' } - if ($allNames.Count -gt 0) { $queryParams['names'] = $allNames -join ',' } - if ($Filter) { $queryParams['filter'] = $Filter } - if ($Sort) { $queryParams['sort'] = $Sort } - if ($Limit -gt 0) { $queryParams['limit'] = $Limit } - if ($TotalOnly) { $queryParams['total_only'] = 'true' } Invoke-PfbApiRequest -Array $Array -Method GET -Endpoint 'object-store-roles/object-store-trust-policies/rules' -QueryParams $queryParams -AutoPaginate } diff --git a/Public/ObjectStore/Get-PfbObjectStoreUserAccessPolicy.ps1 b/Public/ObjectStore/Get-PfbObjectStoreUserAccessPolicy.ps1 index 9688e74..2539c63 100644 --- a/Public/ObjectStore/Get-PfbObjectStoreUserAccessPolicy.ps1 +++ b/Public/ObjectStore/Get-PfbObjectStoreUserAccessPolicy.ps1 @@ -72,14 +72,11 @@ function Get-PfbObjectStoreUserAccessPolicy { end { $queryParams = @{} + Add-PfbCommonQueryParams -Into $queryParams -BoundParameters $PSBoundParameters if ($allMemberNames.Count -gt 0) { $queryParams['member_names'] = $allMemberNames -join ',' } if ($allMemberIds.Count -gt 0) { $queryParams['member_ids'] = $allMemberIds -join ',' } if ($allPolicyNames.Count -gt 0) { $queryParams['policy_names'] = $allPolicyNames -join ',' } if ($allPolicyIds.Count -gt 0) { $queryParams['policy_ids'] = $allPolicyIds -join ',' } - if ($Filter) { $queryParams['filter'] = $Filter } - if ($Sort) { $queryParams['sort'] = $Sort } - if ($Limit -gt 0) { $queryParams['limit'] = $Limit } - if ($TotalOnly) { $queryParams['total_only'] = 'true' } $response = Invoke-PfbApiRequest -Array $Array -Method GET -Endpoint 'object-store-users/object-store-access-policies' -QueryParams $queryParams -AutoPaginate foreach ($item in $response) { diff --git a/Public/Realm/Get-PfbRealm.ps1 b/Public/Realm/Get-PfbRealm.ps1 index 570ec91..ba29e16 100644 --- a/Public/Realm/Get-PfbRealm.ps1 +++ b/Public/Realm/Get-PfbRealm.ps1 @@ -71,12 +71,7 @@ function Get-PfbRealm { end { $queryParams = @{} - if ($allNames.Count -gt 0) { $queryParams['names'] = $allNames -join ',' } - if ($allIds.Count -gt 0) { $queryParams['ids'] = $allIds -join ',' } - if ($Filter) { $queryParams['filter'] = $Filter } - if ($Sort) { $queryParams['sort'] = $Sort } - if ($Limit -gt 0) { $queryParams['limit'] = $Limit } - if ($TotalOnly) { $queryParams['total_only'] = 'true' } + Add-PfbCommonQueryParams -Into $queryParams -BoundParameters $PSBoundParameters -Names $allNames -Ids $allIds if ($Destroyed) { $queryParams['destroyed'] = 'true' } Invoke-PfbApiRequest -Array $Array -Method GET -Endpoint 'realms' -QueryParams $queryParams -AutoPaginate diff --git a/Public/Server/Get-PfbServer.ps1 b/Public/Server/Get-PfbServer.ps1 index 2c8c46a..c6a1c06 100644 --- a/Public/Server/Get-PfbServer.ps1 +++ b/Public/Server/Get-PfbServer.ps1 @@ -73,12 +73,7 @@ function Get-PfbServer { end { $queryParams = @{} - if ($allNames.Count -gt 0) { $queryParams['names'] = $allNames -join ',' } - if ($allIds.Count -gt 0) { $queryParams['ids'] = $allIds -join ',' } - if ($Filter) { $queryParams['filter'] = $Filter } - if ($Sort) { $queryParams['sort'] = $Sort } - if ($Limit -gt 0) { $queryParams['limit'] = $Limit } - if ($TotalOnly) { $queryParams['total_only'] = 'true' } + Add-PfbCommonQueryParams -Into $queryParams -BoundParameters $PSBoundParameters -Names $allNames -Ids $allIds Invoke-PfbApiRequest -Array $Array -Method GET -Endpoint 'servers' -QueryParams $queryParams -AutoPaginate }