startMaintenance method

Future<StartMaintenanceResponse> startMaintenance({
  1. required String serverName,
  2. List<EngineAttribute>? engineAttributes,
})

Manually starts server maintenance. This command can be useful if an earlier maintenance attempt failed, and the underlying cause of maintenance failure has been resolved. The server is in an UNDER_MAINTENANCE state while maintenance is in progress.

Maintenance can only be started on servers in HEALTHY and UNHEALTHY states. Otherwise, an InvalidStateException is thrown. A ResourceNotFoundException is thrown when the server does not exist. A ValidationException is raised when parameters of the request are not valid.

May throw InvalidStateException. May throw ResourceNotFoundException. May throw ValidationException.

Parameter serverName : The name of the server on which to run maintenance.

Parameter engineAttributes : Engine attributes that are specific to the server on which you want to run maintenance.

Attributes accepted in a StartMaintenance request for Chef

Implementation

Future<StartMaintenanceResponse> startMaintenance({
  required String serverName,
  List<EngineAttribute>? engineAttributes,
}) async {
  ArgumentError.checkNotNull(serverName, 'serverName');
  _s.validateStringLength(
    'serverName',
    serverName,
    1,
    40,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'OpsWorksCM_V2016_11_01.StartMaintenance'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ServerName': serverName,
      if (engineAttributes != null) 'EngineAttributes': engineAttributes,
    },
  );

  return StartMaintenanceResponse.fromJson(jsonResponse.body);
}