Skip to content

Commit

Permalink
Merge pull request #77 from PureStorage-OpenConnect/dev/aguzev/rename…
Browse files Browse the repository at this point in the history
…_host_volume_cmdlets

Rename HostVolumes cmdlets
  • Loading branch information
barkz authored Apr 29, 2023
2 parents f82a86d + ce7a0ad commit b369ea4
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 125 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ FunctionsToExport = @(
'New-Pfa2VolumeShadowCopy',
'Enable-Pfa2SecureChannelProtocol',
'Disable-Pfa2SecureChannelProtocol',
'Register-Pfa2HostVolumes',
'Unregister-Pfa2HostVolumes',
'Mount-Pfa2HostVolumes',
'Dismount-Pfa2HostVolumes',
'Update-Pfa2DriveInformation',
'Test-Pfa2WindowsBestPractices'
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@

#Requires -Version 5

#region Helper functions

function Convert-UnitOfSize {
[CmdletBinding()]
param (
[parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)]
$Value,
$To = 1GB,
$From = 1,
$Decimals = 2
)

process {
return [math]::Round($Value * $From / $To, $Decimals)
}
}
#region Helper functions

function Convert-UnitOfSize {
[CmdletBinding()]
param (
[parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)]
$Value,
$To = 1GB,
$From = 1,
$Decimals = 2
)

process {
return [math]::Round($Value * $From / $To, $Decimals)
}
}

function Write-Color {
[CmdletBinding()]
Expand Down Expand Up @@ -109,89 +109,89 @@ function Write-Color {
}
}

#endregion Helper functions

function Get-Pfa2SerialNumbers() {
<#
.SYNOPSIS
Retrieves FlashArray disk serial numbers connected to the host.
.DESCRIPTION
Cmdlet retrieves disk serial numbers that are associated to Pure FlashArrays.
.PARAMETER CimSession
Optional. A CimSession or computer name. CIM session may be reused.
.INPUTS
CimSession is optional.
.OUTPUTS
Outputs serial numbers of FlashArrays devices.
.EXAMPLE
Get-Pfa2SerialNumbers
Returns serial number information on Pure FlashArray disk devices connected to the host.
.EXAMPLE
Get-Pfa2SerialNumbers -CimSession 'myComputer'
Returns serial number information on Pure FlashArray disk devices connected to 'myComputer' with current credentials.
.EXAMPLE
$session = New-CimSession 'myComputer' -Credential (Get-Credential)
Get-Pfa2SerialNumbers -CimSession $session
Get-Pfa2HostBusAdapter -CimSession $session
Returns serial number information on Pure FlashArray disk devices and host bus adapter
with previously created CIM session.
.EXAMPLE
Get-Pfa2SerialNumbers -CimSession (New-CimSession 'myComputer' -Credential $Creds)
Returns serial number information on Pure FlashArray disk devices connected to 'myComputer'
with credentials stored in variable $Creds.
.EXAMPLE
Get-Pfa2SerialNumbers -CimSession (New-CimSession 'myComputer' -Credential (Get-Secret admin))
Returns serial number information on Pure FlashArray disk devices connected to 'myComputer'
with credentials stored in a secret vault.
.EXAMPLE
Get-Pfa2SerialNumbers -CimSession (New-CimSession 'myComputer' -Credential (Get-Credential))
Returns serial number information on Pure FlashArray disk devices connected to 'myComputer'. Asks for credentials.
.EXAMPLE
'myComputer' | Get-Pfa2SerialNumbers
Returns serial number information on Pure FlashArray disk devices connected to 'myComputer' with current credentials.
.EXAMPLE
$session = New-CimSession 'myComputer' -Credential (Get-Credential)
$session | Get-Pfa2SerialNumbers
Returns serial number information on Pure FlashArray disk devices with previously created CIM session.
.EXAMPLE
'myComputer01', 'myComputer02' | Get-Pfa2SerialNumbers
Returns serial number information on Pure FlashArray disk devices connected to 'myComputer01' and 'myComputer02' with current credentials.
.EXAMPLE
$prod = [pscustomobject]@{Caption = 'Prod Server'; CimSession = 'myComputer'}
$prod | Get-Pfa2SerialNumbers
Returns serial number information on Pure FlashArray disk devices connected to 'myComputer' with current credentials.
#>

[CmdletBinding()]
Param (
[Parameter(ValueFromPipeline, ValueFromPipelineByPropertyName)]
[ValidateNotNull()]
[CimSession]$CimSession
)

process {
Get-Disk -FriendlyName 'PURE FlashArray*' @PSBoundParameters | Select-Object PSComputerName, Number, SerialNumber
}
}
#endregion Helper functions

function Get-Pfa2SerialNumbers() {
<#
.SYNOPSIS
Retrieves FlashArray disk serial numbers connected to the host.
.DESCRIPTION
Cmdlet retrieves disk serial numbers that are associated to Pure FlashArrays.
.PARAMETER CimSession
Optional. A CimSession or computer name. CIM session may be reused.
.INPUTS
CimSession is optional.
.OUTPUTS
Outputs serial numbers of FlashArrays devices.
.EXAMPLE
Get-Pfa2SerialNumbers
Returns serial number information on Pure FlashArray disk devices connected to the host.
.EXAMPLE
Get-Pfa2SerialNumbers -CimSession 'myComputer'
Returns serial number information on Pure FlashArray disk devices connected to 'myComputer' with current credentials.
.EXAMPLE
$session = New-CimSession 'myComputer' -Credential (Get-Credential)
Get-Pfa2SerialNumbers -CimSession $session
Get-Pfa2HostBusAdapter -CimSession $session
Returns serial number information on Pure FlashArray disk devices and host bus adapter
with previously created CIM session.
.EXAMPLE
Get-Pfa2SerialNumbers -CimSession (New-CimSession 'myComputer' -Credential $Creds)
Returns serial number information on Pure FlashArray disk devices connected to 'myComputer'
with credentials stored in variable $Creds.
.EXAMPLE
Get-Pfa2SerialNumbers -CimSession (New-CimSession 'myComputer' -Credential (Get-Secret admin))
Returns serial number information on Pure FlashArray disk devices connected to 'myComputer'
with credentials stored in a secret vault.
.EXAMPLE
Get-Pfa2SerialNumbers -CimSession (New-CimSession 'myComputer' -Credential (Get-Credential))
Returns serial number information on Pure FlashArray disk devices connected to 'myComputer'. Asks for credentials.
.EXAMPLE
'myComputer' | Get-Pfa2SerialNumbers
Returns serial number information on Pure FlashArray disk devices connected to 'myComputer' with current credentials.
.EXAMPLE
$session = New-CimSession 'myComputer' -Credential (Get-Credential)
$session | Get-Pfa2SerialNumbers
Returns serial number information on Pure FlashArray disk devices with previously created CIM session.
.EXAMPLE
'myComputer01', 'myComputer02' | Get-Pfa2SerialNumbers
Returns serial number information on Pure FlashArray disk devices connected to 'myComputer01' and 'myComputer02' with current credentials.
.EXAMPLE
$prod = [pscustomobject]@{Caption = 'Prod Server'; CimSession = 'myComputer'}
$prod | Get-Pfa2SerialNumbers
Returns serial number information on Pure FlashArray disk devices connected to 'myComputer' with current credentials.
#>

[CmdletBinding()]
Param (
[Parameter(ValueFromPipeline, ValueFromPipelineByPropertyName)]
[ValidateNotNull()]
[CimSession]$CimSession
)

process {
Get-Disk -FriendlyName 'PURE FlashArray*' @PSBoundParameters | Select-Object PSComputerName, Number, SerialNumber
}
}

function Get-Pfa2HostBusAdapter() {
<#
Expand Down Expand Up @@ -765,7 +765,7 @@ function New-Pfa2VolumeShadowCopy() {
}
}

function Register-Pfa2HostVolumes() {
function Mount-Pfa2HostVolumes() {
<#
.SYNOPSIS
Sets Pure FlashArray connected disks to online.
Expand All @@ -778,57 +778,57 @@ function Register-Pfa2HostVolumes() {
.OUTPUTS
None
.EXAMPLE
Register-Pfa2HostVolumes
Mount-Pfa2HostVolumes
Set Pure FlashArray connected disks to online.
.EXAMPLE
Register-Pfa2HostVolumes -CimSession 'myComputer'
Mount-Pfa2HostVolumes -CimSession 'myComputer'
Set to online all Pure FlashArray connected to 'myComputer' with current credentials.
.EXAMPLE
$session = New-CimSession 'myComputer' -Credential (Get-Credential)
Register-Pfa2HostVolumes -CimSession $session
Mount-Pfa2HostVolumes -CimSession $session
Get-Pfa2HostBusAdapter -CimSession $session
Set to online all Pure FlashArray connected to 'myComputer' and gets host bus adapter
with previously created CIM session.
.EXAMPLE
Register-Pfa2HostVolumes -CimSession (New-CimSession 'myComputer' -Credential $Creds)
Mount-Pfa2HostVolumes -CimSession (New-CimSession 'myComputer' -Credential $Creds)
Set to online all Pure FlashArray connected to 'myComputer' with credentials stored in variable $Creds.
.EXAMPLE
Register-Pfa2HostVolumes -CimSession (New-CimSession 'myComputer' -Credential (Get-Secret admin))
Mount-Pfa2HostVolumes -CimSession (New-CimSession 'myComputer' -Credential (Get-Secret admin))
Set to online all Pure FlashArray connected to 'myComputer' with credentials stored in a secret vault.
.EXAMPLE
Register-Pfa2HostVolumes -CimSession (New-CimSession 'myComputer' -Credential (Get-Credential))
Mount-Pfa2HostVolumes -CimSession (New-CimSession 'myComputer' -Credential (Get-Credential))
Set to online all Pure FlashArray connected to 'myComputer'. Asks for credentials.
.EXAMPLE
'myComputer' | Register-Pfa2HostVolumes
'myComputer' | Mount-Pfa2HostVolumes
Set to online all Pure FlashArray connected to 'myComputer' with current credentials.
.EXAMPLE
$session = New-CimSession 'myComputer' -Credential (Get-Credential)
$session | Register-Pfa2HostVolumes
$session | Mount-Pfa2HostVolumes
Set to online all Pure FlashArray connected to 'myComputer' and gets host bus adapter with previously created CIM session.
.EXAMPLE
'myComputer01', 'myComputer02' | Register-Pfa2HostVolumes
'myComputer01', 'myComputer02' | Mount-Pfa2HostVolumes
Set to online all Pure FlashArray connected to 'myComputer01' and 'myComputer02' with current credentials.
.EXAMPLE
$prod = [pscustomobject]@{Caption = 'Prod Server'; CimSession = 'myComputer'}
$prod | Register-Pfa2HostVolumes
$prod | Mount-Pfa2HostVolumes
Set to online all Pure FlashArray connected to 'myComputer' with current credentials.
#>
Expand Down Expand Up @@ -1559,7 +1559,7 @@ function Write-Logo()
Write-Host ''
}

function Unregister-Pfa2HostVolumes() {
function Dismount-Pfa2HostVolumes() {
<#
.SYNOPSIS
Sets Pure FlashArray connected disks to offline.
Expand All @@ -1572,57 +1572,57 @@ function Unregister-Pfa2HostVolumes() {
.OUTPUTS
None
.EXAMPLE
Unregister-Pfa2HostVolumes
Dismount-Pfa2HostVolumes
Set Pure FlashArray connected disks to offline.
.EXAMPLE
Unregister-Pfa2HostVolumes -CimSession 'myComputer'
Dismount-Pfa2HostVolumes -CimSession 'myComputer'
Set to offline all Pure FlashArray disks connected to 'myComputer' with current credentials.
.EXAMPLE
$session = New-CimSession 'myComputer' -Credential (Get-Credential)
Unregister-Pfa2HostVolumes -CimSession $session
Dismount-Pfa2HostVolumes -CimSession $session
Get-Pfa2HostBusAdapter -CimSession $session
Set to offline all Pure FlashArray disks connected to 'myComputer' and gets host bus adapter
with previously created CIM session.
.EXAMPLE
Unregister-Pfa2HostVolumes -CimSession (New-CimSession 'myComputer' -Credential $Creds)
Dismount-Pfa2HostVolumes -CimSession (New-CimSession 'myComputer' -Credential $Creds)
Set to offline all Pure FlashArray disks connected to 'myComputer' with credentials stored in variable $Creds.
.EXAMPLE
Unregister-Pfa2HostVolumes -CimSession (New-CimSession 'myComputer' -Credential (Get-Secret admin))
Dismount-Pfa2HostVolumes -CimSession (New-CimSession 'myComputer' -Credential (Get-Secret admin))
Set to offline all Pure FlashArray disks connected to 'myComputer' with credentials stored in a secret vault.
.EXAMPLE
Unregister-Pfa2HostVolumes -CimSession (New-CimSession 'myComputer' -Credential (Get-Credential))
Dismount-Pfa2HostVolumes -CimSession (New-CimSession 'myComputer' -Credential (Get-Credential))
Set to offline all Pure FlashArray disks connected to 'myComputer'. Asks for credentials.
.EXAMPLE
'myComputer' | Unregister-Pfa2HostVolumes
'myComputer' | Dismount-Pfa2HostVolumes
Set to offline all Pure FlashArray connected to 'myComputer' with current credentials.
.EXAMPLE
$session = New-CimSession 'myComputer' -Credential (Get-Credential)
$session | Unregister-Pfa2HostVolumes
$session | Dismount-Pfa2HostVolumes
Set to offline all Pure FlashArray connected to 'myComputer' and gets host bus adapter with previously created CIM session.
.EXAMPLE
'myComputer01', 'myComputer02' | Unregister-Pfa2HostVolumes
'myComputer01', 'myComputer02' | Dismount-Pfa2HostVolumes
Set to offline all Pure FlashArray connected to 'myComputer01' and 'myComputer02' with current credentials.
.EXAMPLE
$prod = [pscustomobject]@{Caption = 'Prod Server'; CimSession = 'myComputer'}
$prod | Unregister-Pfa2HostVolumes
$prod | Dismount-Pfa2HostVolumes
Set to offline all Pure FlashArray connected to 'myComputer' with current credentials.
#>
Expand Down Expand Up @@ -1764,8 +1764,8 @@ Export-ModuleMember -Function Set-Pfa2WindowsPowerScheme
Export-ModuleMember -Function New-Pfa2VolumeShadowCopy
Export-ModuleMember -Function Enable-Pfa2SecureChannelProtocol
Export-ModuleMember -Function Disable-Pfa2SecureChannelProtocol
Export-ModuleMember -Function Register-Pfa2HostVolumes
Export-ModuleMember -Function Unregister-Pfa2HostVolumes
Export-ModuleMember -Function Mount-Pfa2HostVolumes
Export-ModuleMember -Function Dismount-Pfa2HostVolumes
Export-ModuleMember -Function Update-Pfa2DriveInformation
Export-ModuleMember -Function Test-Pfa2WindowsBestPractices
# END

0 comments on commit b369ea4

Please sign in to comment.