Deleting a recurring maintenance window from a monitor

While the Test Management API does not provide a specific method for deleting a recurring maintenance window, you can easily obtain this goal. The AddOrUpdateMaintenanceWindows request will purge the existing maintenance window(s) in favor of the new maintenance windows that you specify. Consequently, to delete a recurring maintenance window, you must retrieve the current collection of recurring maintenance windows for the monitor and then send a new AddOrUpdateMaintenanceWindows request into the system with the maintenance window to delete omitted from the collection.

Note

This interface is similar to the one provided to manage the deployment of tests to monitor sites in the Test Management API.

Consider the case where the returned set of maintenance windows contains the following:

<RecurringMaintenanceWindows>
     <RecurringMaintenanceWindow dayOfWeek="SAT"
                                 startTime="01:00:00.0000000-04:00"
                                 endTime="02:20:00.0000000-04:00"
                                 deletionFlag="On"/>
     <RecurringMaintenanceWindow dayOfWeek="SUN"
                                 startTime="21:50:00.0000000-05:00"
                                 endTime="22:50:00.0000000-05:00"/>
</RecurringMaintenanceWindows>

To delete the Sunday maintenance window, send the following AddOrUpdateMaintenanceWindows request:

...
   <soapenv:Body>
      <prov:AddOrUpdateMaintenanceWindowsRequest>
         <prov:Credentials>
            <prov:UserName>testuser</prov:UserName>
            <prov:Password>testpassword</prov:Password>
         </prov:Credentials>
         <MaintenanceWindowMonitor monitorId="326334"
                                   xmlns="http://www.gomeznetworks.com/schemas/provisioning">
            <prov:RecurringMaintenanceWindows>
               <prov:RecurringMaintenanceWindow dayOfWeek="SAT"
                                                startTime="01:00:00.0000000-04:00"
                                                endTime="02:20:00.0000000-04:00"
                                                deletionFlag="On"/>
            </prov:RecurringMaintenanceWindows>
         </MaintenanceWindowMonitor>
      </prov:AddOrUpdateMaintenanceWindowsRequest>
   </soapenv:Body>
...

Since this request does not include the Sunday maintenance window definition, and one exists in the system, the Sunday definition is purged from the system by the request. However, the existing Saturday definition is also purged and recreated by this request. The net result is that one window definition is purged.