Public/Firmware.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#
# Copyright 2022, Alexis La Goutte <alexis dot lagoutte at gmail dot com>
#
# SPDX-License-Identifier: Apache-2.0
#

function Get-ArubaCXFirmware {

    <#
        .SYNOPSIS
        Get Aruba CX firmware

        .DESCRIPTION
        Get all informations about Aruba CX firmware

        .EXAMPLE
        Get-ArubaCXFirmware

        Get all informations about Aruba CX firmware, primary image and secondary image...

        .EXAMPLE
        Get-ArubaCXFirmware -status

        Get status (date, reason, status) about Aruba CX firmware.
    #>


    Param(
        [Parameter(Mandatory = $false)]
        [switch]$status,
        [Parameter(Mandatory = $false)]
        [switch]$vsx_peer,
        [Parameter (Mandatory = $False)]
        [ValidateNotNullOrEmpty()]
        [PSObject]$connection = $DefaultArubaCXConnection
    )

    Begin {
    }

    Process {

        $invokeParams = @{ }
        #don't have depth, selector or attributes...
        if ( $PsBoundParameters.ContainsKey('vsx_peer') ) {
            $invokeParams.add( 'vsx_peer', $true )
        }

        $uri = "firmware"

        if ( $PsBoundParameters.ContainsKey('status') ) {
            $uri += "/status"
        }

        $response = Invoke-ArubaCXRestMethod -uri $uri -method 'GET' -connection $connection @invokeParams
        $response
    }

    End {
    }
}