Public/Targets/Add-SIASSHHostKeyFingerprint.ps1

function Add-SIASSHHostKeyFingerprint {
    <#
    .SYNOPSIS
        Adds a trusted SSH host key fingerprint for a target.
    .DESCRIPTION
        Calls the Add Fingerprint operation, registering 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
        Add-SIASSHHostKeyFingerprint -TargetId 'target-01' -Fingerprint 'SHA256:abc123...'

        Registers a trusted fingerprint 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, 'Add SSH host key fingerprint')) {
        $body = @{
            target_id   = $TargetId
            fingerprint = $Fingerprint
        }
        Invoke-SIARequest -Method POST -Path '/api/ssh-fingerprints' -Body $body |
            ConvertFrom-SIAResponse -TypeName 'psSIA.SSHHostKeyFingerprint'
    }
}