Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Private/Add-PfbCommonQueryParams.ps1
Original file line number Diff line number Diff line change
@@ -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 ',' }
}
7 changes: 1 addition & 6 deletions Public/Bucket/Get-PfbBucket.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 1 addition & 6 deletions Public/Bucket/Get-PfbBucketPerformance.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
7 changes: 1 addition & 6 deletions Public/Bucket/Get-PfbBucketS3Performance.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
7 changes: 1 addition & 6 deletions Public/FileSystem/Get-PfbFileLock.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
7 changes: 1 addition & 6 deletions Public/FileSystem/Get-PfbFileLockClient.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
7 changes: 1 addition & 6 deletions Public/FileSystem/Get-PfbFileSystem.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 1 addition & 6 deletions Public/FileSystem/Get-PfbFileSystemExport.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
5 changes: 1 addition & 4 deletions Public/FileSystem/Get-PfbFileSystemGroupPerformance.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
6 changes: 1 addition & 5 deletions Public/FileSystem/Get-PfbFileSystemSession.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 1 addition & 6 deletions Public/FileSystem/Get-PfbFileSystemStorageClass.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions Public/FileSystem/Get-PfbFileSystemUserPerformance.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
7 changes: 1 addition & 6 deletions Public/FileSystem/Get-PfbOpenFile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
7 changes: 1 addition & 6 deletions Public/FileSystemSnapshot/Get-PfbFileSystemSnapshot.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
7 changes: 1 addition & 6 deletions Public/ObjectStore/Get-PfbObjectStoreAccessPolicy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
5 changes: 1 addition & 4 deletions Public/ObjectStore/Get-PfbObjectStoreAccessPolicyAction.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
5 changes: 1 addition & 4 deletions Public/ObjectStore/Get-PfbObjectStoreAccessPolicyRole.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 1 addition & 5 deletions Public/ObjectStore/Get-PfbObjectStoreAccessPolicyRule.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
5 changes: 1 addition & 4 deletions Public/ObjectStore/Get-PfbObjectStoreAccessPolicyUser.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
7 changes: 1 addition & 6 deletions Public/ObjectStore/Get-PfbObjectStoreAccount.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
7 changes: 1 addition & 6 deletions Public/ObjectStore/Get-PfbObjectStoreAccountExport.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Loading