Public/cloud-system.ps1
|
# Define aliases Set-Alias -Name Get-CloudConfig -value Get-CloudSystemConfig Set-Alias -Name Get-CloudVersion -value Get-CloudSystemVersion function Get-CloudSystemConfig { <# .SYNOPSIS Retrieves the config from the Cloud Server. .DESCRIPTION Retrieves a the full cloud config. Automatically handles token refresh. .EXAMPLE # Retrieve the full configuration Get-CloudSystemConfig #> $uri = "$($script:CloudConnection.BaseUri)/manifold-api/v2/cloud/system/config" $response = Invoke-CloudApiRequest -Uri $uri -Method Get $config = $response.config return $config } function Get-CloudSystemVersion { <# .SYNOPSIS Retrieves the version from the Cloud Server. .DESCRIPTION Retrieves the current cloud version. Automatically handles token refresh. .EXAMPLE # Return the current version Get-CloudSystemversion #> $uri = "$($script:CloudConnection.BaseUri)/manifold-api/v2/cloud/system/version" $response = (Invoke-CloudApiRequest -Uri $uri -Method Get).version $coreversion = ($response)#.version return $response #$uri = "$($script:CloudConnection.BaseUri)/manifold-api/v2/cloud/system/version/" #$response = Invoke-CloudApiRequest -Uri $uri -Method Get #$product = ($response).product_name #$version = ($response).product_release # #write-host $coreversion #write-host " " #write-host "Product: | Release:" #write-host "$product | $version" } function Get-SoftIronVersion { <# .SYNOPSIS Retrieves the version from the Cloud Server. .DESCRIPTION Retrieves the current cloud version. Automatically handles token refresh. .EXAMPLE # Get the product and release version Get-SoftIronVersion .EXAMPLE # ??? Get-SoftIronVersion -Adventure #> [CmdletBinding()] param( [Parameter(Mandatory = $false)] [switch]$Logo, [Parameter(Mandatory = $false)] [switch]$Adventure ) #$uri = "$($script:CloudConnection.BaseUri)/manifold-api/v2/cloud/system/version" #$response = (Invoke-CloudApiRequest -Uri $uri -Method Get).version #$coreversion = ($response)#.version #return $response $uri = "$($script:CloudConnection.BaseUri)/manifold-api/v2/cloud/system/version/" $response = Invoke-CloudApiRequest -Uri $uri -Method Get $product = ($response).product_name $version = ($response).product_release if ($logo) { #write-host $coreversion #cls write-host " " get-softironlogo write-host "Product: | Release:" write-host "$product | $version" } elseif ($Adventure){ cls get-softironlogo Start-SoftIronAdventure } else { write-host "Product: | Release:" write-host "$product | $version" } } |