Set-ServiceFabricChaosSchedule

Set the schedule to be used by the Chaos Scheduler.

Syntax

Set-ServiceFabricChaosSchedule
   -ChaosScheduleDescription <ChaosScheduleDescription>
   [-TimeoutSec <Int32>]
   [<CommonParameters>]

Description

The Set-ServiceFabricChaosSchedule cmdlet sets the schedule to be used by the Chaos Scheduler. The Chaos Scheduler will start running Chaos during based on the specified schedule.

Examples

Example 1

PS C:\> $JobStartTime = New-Object -TypeName System.Fabric.Chaos.DataStructures.ChaosScheduleTimeUtc (0,0)
PS C:\> $JobEndTime = New-Object -TypeName System.Fabric.Chaos.DataStructures.ChaosScheduleTimeUtc (12,59)
PS C:\> $JobTimeRange = New-Object -TypeName System.Fabric.Chaos.DataStructures.ChaosScheduleTimeRangeUtc ($JobStartTime, $JobEndTime)

PS C:\> $activeDays = New-Object -TypeName System.Collections.Generic.HashSet[DayOfWeek]
PS C:\> $activeDays.Add([System.DayOfWeek]::Monday)
PS C:\> $activeDays.Add([System.DayOfWeek]::Tuesday)
PS C:\> $activeDays.Add([System.DayOfWeek]::Wednesday)
PS C:\> $activeDays.Add([System.DayOfWeek]::Thursday)
PS C:\> $activeDays.Add([System.DayOfWeek]::Friday)
PS C:\> $JobActiveDays = New-Object -TypeName System.Fabric.Chaos.DataStructures.ChaosScheduleJobActiveDays ($activeDays)

PS C:\> $JobActiveTimes = New-Object -TypeName System.Collections.Generic.List[System.Fabric.Chaos.DataStructures.ChaosScheduleTimeRangeUtc]
PS C:\> $JobActiveTimes.Add($JobTimeRange)
PS C:\> $Job = New-Object -TypeName System.Fabric.Chaos.DataStructures.ChaosScheduleJob ("adhoc", $JobActiveDays, $JobActiveTimes)
PS C:\> $Jobs.Add($Job)

PS C:\> $ChaosParameters = New-Object -TypeName System.Fabric.Chaos.DataStructures.ChaosParameters
PS C:\> $ChaosParametersDictionary = New-Object 'System.Collections.Generic.Dictionary[string,System.Fabric.Chaos.Datastructures.ChaosParameters]'
PS C:\> $ChaosParametersDictionary.Add("adhoc", $ChaosParameters)

PS C:\> $Now = Get-Date
PS C:\> $StartTime = $Now.ToUniversalTime()
PS C:\> $EndTime = $StartTime.AddDays(100)
PS C:\> $ChaosSchedule = New-Object -TypeName System.Fabric.Chaos.DataStructures.ChaosSchedule ($StartTime, $EndTime, $ChaosParametersDictionary, $Jobs)

PS C:\> $ChaosScheduleDescription = New-Object -TypeName System.Fabric.Chaos.DataStructures.ChaosScheduleDescription (0, $ChaosSchedule)
PS C:\> Set-ServiceFabricChaosSchedule -ChaosSchedule $ChaosScheduleDescription

Set a schedule that specifies Chaos to be ran 24 hours a day starting Monday and ending Friday (based on UTC timezone). This schedule will remain active for 100 days, during which, the Chaos Scheduler will follow this schedule to run Chaos. To stop the schedule, use the Stop-ServiceFabricChaos cmdlet.

Parameters

-ChaosScheduleDescription

The schedule that will be set for the Chaos Scheduler to use.

Type:ChaosScheduleDescription
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-TimeoutSec

Specifies the timeout period, in seconds for the operation.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

Outputs

System.Object