Public/Platform.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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# # Copyright 2018-2020, Alexis La Goutte <alexis.lagoutte at gmail dot com> # # SPDX-License-Identifier: Apache-2.0 # function Get-ArubaCPCPPMVersion { <# .SYNOPSIS Get CPPM Version info on CPPM .DESCRIPTION Get CPPM Version (major, minor, hardware, eval... ) .EXAMPLE Get-ArubaCPCPPMVersion Get CPPM Version #> Param( [Parameter (Mandatory = $False)] [ValidateNotNullOrEmpty()] [PSObject]$connection = $DefaultArubaCPConnection ) Begin { } Process { $uri = "api/cppm-version" $cv = Invoke-ArubaCPRestMethod -method "GET" -uri $uri -connection $connection $cv } End { } } function Get-ArubaCPServerConfiguration { <# .SYNOPSIS Get Server Configuration info on CPPM .DESCRIPTION Get Server Configuration (name, uuid, server / management ip... ) .EXAMPLE Get-ArubaCPServerConfiguration Get Server Configuration #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", '')] #False positive see https://github.com/PowerShell/PSScriptAnalyzer/issues/1472 [CmdLetBinding(DefaultParameterSetName = "Default")] Param( [Parameter (Mandatory = $false, ParameterSetName = "uuid")] [string]$uuid, [Parameter (Mandatory = $false, ParameterSetName = "name")] [string]$name, [Parameter (Mandatory = $false, ParameterSetName = "ip_address")] [ipaddress]$ip_address, [Parameter (Mandatory = $False)] [ValidateNotNullOrEmpty()] [PSObject]$connection = $DefaultArubaCPConnection ) Begin { } Process { $uri = "api/cluster/server" $sc = Invoke-ArubaCPRestMethod -method "GET" -uri $uri -connection $connection switch ( $PSCmdlet.ParameterSetName ) { "uuid" { $sc._embedded.items | Where-Object { $_.server_uuid -eq $uuid } } "name" { $sc._embedded.items | Where-Object { $_.name -eq $name } } "ip_address" { $sc._embedded.items | Where-Object { $_.management_ip -eq $ip_address } } default { $sc._embedded.items } } } End { } } function Get-ArubaCPServerVersion { <# .SYNOPSIS Get Server Version info on CPPM .DESCRIPTION Get Server Version (CPPM version, Guest, Installed Patches ) .EXAMPLE Get-ArubaCPServerVersion Get Server Version #> Param( [Parameter (Mandatory = $False)] [ValidateNotNullOrEmpty()] [PSObject]$connection = $DefaultArubaCPConnection ) Begin { } Process { $uri = "api/server/version" $sv = Invoke-ArubaCPRestMethod -method "GET" -uri $uri -connection $connection $sv } End { } } |