Public/Targets/Set-SIASSHHostKeyFingerprint.ps1

function Set-SIASSHHostKeyFingerprint {
    <#
    .SYNOPSIS
        Updates a trusted SSH host key fingerprint.
    .DESCRIPTION
        Calls the Update Fingerprint operation, replacing the fingerprint SIA
        validates against when connecting to the target over SSH.
    .PARAMETER TargetId
        The target's ID.
    .PARAMETER Fingerprint
        The SSH host key fingerprint value.
    .EXAMPLE
        Set-SIASSHHostKeyFingerprint -TargetId 'target-01' -Fingerprint 'SHA256:def456...'

        Updates the trusted fingerprint recorded for the specified target.
    .INPUTS
        None.
    .OUTPUTS
        psSIA.SSHHostKeyFingerprint
    .LINK
        https://api-docs.cyberark.com/secure-infra-access/docs/sia-ssh-host-key-fingerprints-api
    #>

    [CmdletBinding(SupportsShouldProcess)]
    [OutputType('psSIA.SSHHostKeyFingerprint')]
    param(
        [Parameter(Mandatory)]
        [ValidateLength(1, 255)]
        [string]$TargetId,

        [Parameter(Mandatory)]
        [ValidateLength(1, 255)]
        [string]$Fingerprint
    )

    if ($PSCmdlet.ShouldProcess($TargetId, 'Update SSH host key fingerprint')) {
        $body = @{
            target_id   = $TargetId
            fingerprint = $Fingerprint
        }
        Invoke-SIARequest -Method PUT -Path '/api/ssh-fingerprints' -Body $body |
            ConvertFrom-SIAResponse -TypeName 'psSIA.SSHHostKeyFingerprint'
    }
}