Public/Connectors/Update-SIAHttpsRelay.ps1
|
function Update-SIAHttpsRelay { <# .SYNOPSIS Upgrades or rotates the credentials of a SIA HTTPS relay. .DESCRIPTION Wraps the HTTPS relay Upgrade and Rotate operations. Exactly one of -Upgrade or -Rotate must be specified. .PARAMETER Id The HTTPS relay's id, as returned by Get-SIAHttpsRelay. .PARAMETER Upgrade Upgrades the HTTPS relay to the latest available version. .PARAMETER Rotate Rotates the HTTPS relay's credentials. .EXAMPLE Get-SIAHttpsRelay | Update-SIAHttpsRelay -Rotate Rotates credentials for every HTTPS relay on the tenant. .INPUTS psSIA.HttpsRelay .OUTPUTS None. .LINK https://api-docs.cyberark.com/secure-infra-access/docs/sia-connector-api #> [CmdletBinding(SupportsShouldProcess)] [Diagnostics.CodeAnalysis.SuppressMessage('PSReviewUnusedParameter', '', Justification = 'Upgrade and Rotate select the parameter set; the branch below reads ParameterSetName, not the switch values themselves.')] param( [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [string]$Id, [Parameter(Mandatory, ParameterSetName = 'Upgrade')] [switch]$Upgrade, [Parameter(Mandatory, ParameterSetName = 'Rotate')] [switch]$Rotate ) process { $action = if ($PSCmdlet.ParameterSetName -eq 'Upgrade') { 'upgrade' } else { 'rotate' } if ($PSCmdlet.ShouldProcess($Id, "HTTPS relay $action")) { Invoke-SIARequest -Method POST -Path "/api/https-relays/$Id/$action" | ConvertFrom-SIAResponse -TypeName 'psSIA.HttpsRelay' } } } |