Public/Set-GCRecordingPolicy.ps1

<#
.SYNOPSIS
    Updates an existing recording media retention policy in Genesys Cloud.

.DESCRIPTION
    Sends a PUT request to the Genesys Cloud API to replace the configuration
    of a specific cross-platform media retention policy.
    API Endpoint: PUT /api/v2/recording/crossplatform/mediaretentionpolicies/{policyId}

.PARAMETER PolicyId
    The unique identifier of the recording policy to update.

.PARAMETER Body
    The request body containing the full updated policy configuration.
    Should conform to the Genesys Cloud media retention policy schema.

.EXAMPLE
    $policyBody = @{
        name = 'Updated Compliance Policy'
        enabled = $true
        version = 2
        actions = @{
            retainRecording = $true
            retentionDuration = @{ archiveRetention = @{ days = 730 } }
        }
    }
    Set-GCRecordingPolicy -PolicyId 'policy-abc123' -Body $policyBody
    Updates the specified recording policy with the new configuration.

.NOTES
    Genesys Cloud API: PUT /api/v2/recording/crossplatform/mediaretentionpolicies/{policyId}
#>

function Set-GCRecordingPolicy {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory = $true)]
        [string]$PolicyId,

        [Parameter(Mandatory = $true)]
        [object]$Body
    )

    $endpoint = "recording/crossplatform/mediaretentionpolicies/$PolicyId"
    return Invoke-GCApiRequest -Endpoint $endpoint -Method PUT -Body $Body
}