Public/New-IdempotenceIdentifier.ps1

<#
    .DESCRIPTION
    Wrapper for Nutanix API version 0.3.
 
    .NOTES
    Author: Timothy Rasiah
#>


function New-IdempotenceIdentifier {
    [CmdletBinding()]
    param (
        [String]$ClientIdentifier,
        [Parameter(Mandatory=$true)]
        [ValidateRange(1, 4096)]
        [Int]$Count,
        [ValidateRange(1, 527040)]
        [Int]$ValidDurationInMinutes
    )

    $data = @{
        "count" = $Count
    }

    if ($ClientIdentifier) {
        $data["client_identifier"] = $ClientIdentifier
    }

    if ($ValidDurationInMinutes) {
        $data["valid_duration_in_minutes"] = $ValidDurationInMinutes
    }
    
    $response = Send-Request -method "POST" -endpoint "/idempotence_identifiers" -data $data
    return $response
}