functions/Set-VaoFailoverPlan.psm1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Function Set-VaoFailoverPlan {
    <#
    .DESCRIPTION
        Modify Veeam Availability Orchestrator FailoverPlan
 
    .NOTES
        File Name : Set-VaoFailoverPlan.psm1
        Author : Markus Kraus
        Version : 1.0
        State : Ready
 
    .LINK
        https://mycloudrevolution.com/
 
    .EXAMPLE
        Set-VaoFailoverPlan -PlanID ed799d88-30f0-4494-b183-124e171afa91 -Enable
 
    .EXAMPLE
        Set-VaoFailoverPlan -PlanID ed799d88-30f0-4494-b183-124e171afa91 -Disable
 
    .PARAMETER PlanID
        Failover Plan ID
 
    .PARAMETER Enable
        Enable Failover Plan
 
    .PARAMETER Disable
        Disable Failover Plan
    #>

        Param (
            [Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Failover Plan ID")]
            [ValidateNotNullorEmpty()]
                [String]$PlanID,
            [Parameter(Mandatory=$True, ValueFromPipeline=$False, ParameterSetName="Enable", HelpMessage="Enable Failover Plan")]
            [ValidateNotNullorEmpty()]
                [Switch]$Enable,
            [Parameter(Mandatory=$True, ValueFromPipeline=$False, ParameterSetName="Disable", HelpMessage="Disable Failover Plan")]
            [ValidateNotNullorEmpty()]
                [Switch]$Disable
        )
        Process {
            if ($Enable) {
                $Return = Invoke-VaoApiCall -Uri "/v1/FailoverPlans/$PlanID/Enable" -Method Post
            }
            elseif ($Disable) {
                $Return = Invoke-VaoApiCall -Uri "/v1/FailoverPlans/$PlanID/Disable" -Method Post
            }

            $Return
        }
    }