Functions/Set-IAView.ps1

Function Set-IAView {
    <#
        .SYNOPSIS
            This is used to change a View.
        .DESCRIPTION
            This function is used to change the properties of a View.
        .EXAMPLE
            Get-IAView -All
 
            $IAView = Get-IAView -Name 'View Name Here'
 
            $IAView.Name = 'New cool name'
 
            Set-IAView -IAView $IAView
    #>

    Param(
        [Parameter(Mandatory = $true)]
        [PSObject] $IAView
    )

    $Uri = "Views($($IAView.Id))"

    $Body = $IAView | ConvertTo-Json

    Write-Verbose "Body: $Body"

    $response = Invoke-IAQuery -QueryUrl $Uri -Method Patch -Body $Body
    if ($null -eq $response.value) {
        return $null
    }

    return $response.value
}