updateMaintenanceWindow method
Updates an existing maintenance window. Only specified parameters are modified.
May throw DoesNotExistException. May throw InternalServerError.
Parameter windowId
:
The ID of the maintenance window to update.
Parameter allowUnassociatedTargets
:
Whether targets must be registered with the maintenance window before
tasks can be defined for those targets.
Parameter cutoff
:
The number of hours before the end of the maintenance window that Systems
Manager stops scheduling new tasks for execution.
Parameter description
:
An optional description for the update request.
Parameter duration
:
The duration of the maintenance window in hours.
Parameter enabled
:
Whether the maintenance window is enabled.
Parameter endDate
:
The date and time, in ISO-8601 Extended format, for when you want the
maintenance window to become inactive. EndDate allows you to set a date
and time in the future when the maintenance window will no longer run.
Parameter name
:
The name of the maintenance window.
Parameter replace
:
If True, then all fields that are required by the CreateMaintenanceWindow
action are also required for this API request. Optional fields that are
not specified are set to null.
Parameter schedule
:
The schedule of the maintenance window in the form of a cron or rate
expression.
Parameter scheduleOffset
:
The number of days to wait after the date and time specified by a CRON
expression before running the maintenance window.
For example, the following cron expression schedules a maintenance window to run the third Tuesday of every month at 11:30 PM.
cron(30 23 ? * TUE#3 *)
If the schedule offset is 2
, the maintenance window won't run
until two days later.
Parameter scheduleTimezone
:
The time zone that the scheduled maintenance window executions are based
on, in Internet Assigned Numbers Authority (IANA) format. For example:
"America/Los_Angeles", "UTC", or "Asia/Seoul". For more information, see
the Time Zone Database on
the IANA website.
Parameter startDate
:
The time zone that the scheduled maintenance window executions are based
on, in Internet Assigned Numbers Authority (IANA) format. For example:
"America/Los_Angeles", "UTC", or "Asia/Seoul". For more information, see
the Time Zone Database on
the IANA website.
Implementation
Future<UpdateMaintenanceWindowResult> updateMaintenanceWindow({
required String windowId,
bool? allowUnassociatedTargets,
int? cutoff,
String? description,
int? duration,
bool? enabled,
String? endDate,
String? name,
bool? replace,
String? schedule,
int? scheduleOffset,
String? scheduleTimezone,
String? startDate,
}) async {
ArgumentError.checkNotNull(windowId, 'windowId');
_s.validateStringLength(
'windowId',
windowId,
20,
20,
isRequired: true,
);
_s.validateNumRange(
'cutoff',
cutoff,
0,
23,
);
_s.validateStringLength(
'description',
description,
1,
128,
);
_s.validateNumRange(
'duration',
duration,
1,
24,
);
_s.validateStringLength(
'name',
name,
3,
128,
);
_s.validateStringLength(
'schedule',
schedule,
1,
256,
);
_s.validateNumRange(
'scheduleOffset',
scheduleOffset,
1,
6,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AmazonSSM.UpdateMaintenanceWindow'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'WindowId': windowId,
if (allowUnassociatedTargets != null)
'AllowUnassociatedTargets': allowUnassociatedTargets,
if (cutoff != null) 'Cutoff': cutoff,
if (description != null) 'Description': description,
if (duration != null) 'Duration': duration,
if (enabled != null) 'Enabled': enabled,
if (endDate != null) 'EndDate': endDate,
if (name != null) 'Name': name,
if (replace != null) 'Replace': replace,
if (schedule != null) 'Schedule': schedule,
if (scheduleOffset != null) 'ScheduleOffset': scheduleOffset,
if (scheduleTimezone != null) 'ScheduleTimezone': scheduleTimezone,
if (startDate != null) 'StartDate': startDate,
},
);
return UpdateMaintenanceWindowResult.fromJson(jsonResponse.body);
}