startRemediationExecution method

Future<StartRemediationExecutionResponse> startRemediationExecution({
  1. required String configRuleName,
  2. required List<ResourceKey> resourceKeys,
})

Runs an on-demand remediation for the specified AWS Config rules against the last known remediation configuration. It runs an execution against the current state of your resources. Remediation execution is asynchronous.

You can specify up to 100 resource keys per request. An existing StartRemediationExecution call for the specified resource keys must complete before you can call the API again.

May throw InvalidParameterValueException. May throw InsufficientPermissionsException. May throw NoSuchRemediationConfigurationException.

Parameter configRuleName : The list of names of AWS Config rules that you want to run remediation execution for.

Parameter resourceKeys : A list of resource keys to be processed with the current request. Each element in the list consists of the resource type and resource ID.

Implementation

Future<StartRemediationExecutionResponse> startRemediationExecution({
  required String configRuleName,
  required List<ResourceKey> resourceKeys,
}) async {
  ArgumentError.checkNotNull(configRuleName, 'configRuleName');
  _s.validateStringLength(
    'configRuleName',
    configRuleName,
    1,
    128,
    isRequired: true,
  );
  ArgumentError.checkNotNull(resourceKeys, 'resourceKeys');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'StarlingDoveService.StartRemediationExecution'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ConfigRuleName': configRuleName,
      'ResourceKeys': resourceKeys,
    },
  );

  return StartRemediationExecutionResponse.fromJson(jsonResponse.body);
}