Public/New-RecoveryPlanJob.ps1

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


function New-RecoveryPlanJob {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory=$true)]
        [String]$Name,
        [Parameter(Mandatory=$true)]
        [String]$RecoveryPlanUuid,
        [Parameter(Mandatory=$true)]
        [ValidateSet("VALIDATE", "MIGRATE", "FAILOVER", "TEST_FAILOVER", "LIVE_MIGRATE")]
        [String]$ActionType
    )

    $data = @{
        "spec" = @{
            "name" = $Name
            "resources" = @{
                "recovery_plan_reference" = @{
                    "kind" = "recovery_plan"
                    "uuid" = $RecoveryPlanUuid
                }
                "execution_parameters" = @{
                    "recovery_availability_zone_list" = @()
                    "failed_availability_zone_list" = @()
                    "action_type" = $ActionType
                }
            }
        }
        "metadata" = @{
            "kind" = "recovery_plan_job"
        }
    }
    
    $response = Send-Request -method "POST" -endpoint "/recovery_plan_jobs" -data $data
    return $response
}