deregisterTargetFromMaintenanceWindow method

Future<DeregisterTargetFromMaintenanceWindowResult> deregisterTargetFromMaintenanceWindow({
  1. required String windowId,
  2. required String windowTargetId,
  3. bool? safe,
})

Removes a target from a maintenance window.

May throw DoesNotExistException. May throw InternalServerError. May throw TargetInUseException.

Parameter windowId : The ID of the maintenance window the target should be removed from.

Parameter windowTargetId : The ID of the target definition to remove.

Parameter safe : The system checks if the target is being referenced by a task. If the target is being referenced, the system returns an error and does not deregister the target from the maintenance window.

Implementation

Future<DeregisterTargetFromMaintenanceWindowResult>
    deregisterTargetFromMaintenanceWindow({
  required String windowId,
  required String windowTargetId,
  bool? safe,
}) async {
  ArgumentError.checkNotNull(windowId, 'windowId');
  _s.validateStringLength(
    'windowId',
    windowId,
    20,
    20,
    isRequired: true,
  );
  ArgumentError.checkNotNull(windowTargetId, 'windowTargetId');
  _s.validateStringLength(
    'windowTargetId',
    windowTargetId,
    36,
    36,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonSSM.DeregisterTargetFromMaintenanceWindow'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'WindowId': windowId,
      'WindowTargetId': windowTargetId,
      if (safe != null) 'Safe': safe,
    },
  );

  return DeregisterTargetFromMaintenanceWindowResult.fromJson(
      jsonResponse.body);
}