Functions/Customization/Set-PASTheme.ps1
# .ExternalHelp psPAS-help.xml Function Set-PASTheme { [CmdletBinding(SupportsShouldProcess)] param( [parameter( Mandatory = $true, ValueFromPipelinebyPropertyName = $true )] [string]$ThemeName, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $true )] [string]$name, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $true )] [boolean]$isDraft, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$mainBackgroundImage, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$mainLogoDark, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$advancedSmallLogo, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$advancedSymbolLogo, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [ValidateSet('Bright', 'Dark')] [string]$colorsStyle, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$backgroundMain_Dark, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$borderMain_Dark, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$textMain_Dark, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$disableMain_Dark, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$disableTextPrimary_Dark, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$disableBackgroundPrimary_Dark, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$successPrimary_Dark, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$successSecondary_Dark, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$warningPrimary_Dark, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$warningSecondary_Dark, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$infoPrimary_Dark, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$infoSecondary_Dark, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$errorPrimary_Dark, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$errorSecondary_Dark, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$backgroundMain_Bright, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$borderMain_Bright, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$textMain_Bright, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$disableMain_Bright, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$disableTextPrimary_Bright, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$disableBackgroundPrimary_Bright, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$successPrimary_Bright, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$successSecondary_Bright, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$warningPrimary_Bright, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$warningSecondary_Bright, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$infoPrimary_Bright, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$infoSecondary_Bright, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$errorPrimary_Bright, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$errorSecondary_Bright, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$mainColor, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$selectedMain, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$hoverMain, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$defaultButtonTextPrimary, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$menuLogoBackground, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$menuBackground, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$menuHoverBackground, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$menuActiveBackgroundPrimary, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$menuActiveBackgroundSecondary, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$menuText, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$menuTextActive, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$menuIcon, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$backgroundMain, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$borderMain, [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $false )] [string]$textMain ) BEGIN { Assert-VersionRequirement -SelfHosted Assert-VersionRequirement -RequiredVersion 14.4 }#begin PROCESS { #Create URL for request $URI = "$($psPASSession.BaseURI)/API/Themes/$ThemeName/" #Get request parameters $boundParameters = $PSBoundParameters | Get-PASParameter #Get the theme that is being updated $ThemeObject = Get-PASTheme -ThemeName $ThemeName if ($null -ne $ThemeObject) { # Flatten the theme object, and rename properties to match expected input $ThemeObject = Format-FlattenedThemeObject -InputObject $ThemeObject # Format the request object to include all necessary properties, including those not being explicitly updated Format-PutRequestObject -InputObject $ThemeObject -boundParameters $BoundParameters } #Format the request object as required by the API $boundParameters = $boundParameters | Format-PASThemeObject #Construct Request Body $Body = $boundParameters | ConvertTo-Json -Depth 4 if ($PSCmdlet.ShouldProcess($ThemeName, 'Update UI Theme')) { #send request to web service $result = Invoke-PASRestMethod -Uri $URI -Method PUT -Body $Body If ($null -ne $result) { $result } } }#process END { }#end } |