getResourceConfigHistory method

Future<GetResourceConfigHistoryResponse> getResourceConfigHistory({
  1. required String resourceId,
  2. required ResourceType resourceType,
  3. ChronologicalOrder? chronologicalOrder,
  4. DateTime? earlierTime,
  5. DateTime? laterTime,
  6. int? limit,
  7. String? nextToken,
})

Returns a list of configuration items for the specified resource. The list contains details about each state of the resource during the specified time interval. If you specified a retention period to retain your ConfigurationItems between a minimum of 30 days and a maximum of 7 years (2557 days), AWS Config returns the ConfigurationItems for the specified retention period.

The response is paginated. By default, AWS Config returns a limit of 10 configuration items per page. You can customize this number with the limit parameter. The response includes a nextToken string. To get the next page of results, run the request again and specify the string for the nextToken parameter.

May throw ValidationException. May throw InvalidTimeRangeException. May throw InvalidLimitException. May throw InvalidNextTokenException. May throw NoAvailableConfigurationRecorderException. May throw ResourceNotDiscoveredException.

Parameter resourceId : The ID of the resource (for example., sg-xxxxxx).

Parameter resourceType : The resource type.

Parameter chronologicalOrder : The chronological order for configuration items listed. By default, the results are listed in reverse chronological order.

Parameter earlierTime : The time stamp that indicates an earlier time. If not specified, the action returns paginated results that contain configuration items that start when the first configuration item was recorded.

Parameter laterTime : The time stamp that indicates a later time. If not specified, current time is taken.

Parameter limit : The maximum number of configuration items returned on each page. The default is 10. You cannot specify a number greater than 100. If you specify 0, AWS Config uses the default.

Parameter nextToken : The nextToken string returned on a previous page that you use to get the next page of results in a paginated response.

Implementation

Future<GetResourceConfigHistoryResponse> getResourceConfigHistory({
  required String resourceId,
  required ResourceType resourceType,
  ChronologicalOrder? chronologicalOrder,
  DateTime? earlierTime,
  DateTime? laterTime,
  int? limit,
  String? nextToken,
}) async {
  ArgumentError.checkNotNull(resourceId, 'resourceId');
  _s.validateStringLength(
    'resourceId',
    resourceId,
    1,
    768,
    isRequired: true,
  );
  ArgumentError.checkNotNull(resourceType, 'resourceType');
  _s.validateNumRange(
    'limit',
    limit,
    0,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'StarlingDoveService.GetResourceConfigHistory'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'resourceId': resourceId,
      'resourceType': resourceType.toValue(),
      if (chronologicalOrder != null)
        'chronologicalOrder': chronologicalOrder.toValue(),
      if (earlierTime != null)
        'earlierTime': unixTimestampToJson(earlierTime),
      if (laterTime != null) 'laterTime': unixTimestampToJson(laterTime),
      if (limit != null) 'limit': limit,
      if (nextToken != null) 'nextToken': nextToken,
    },
  );

  return GetResourceConfigHistoryResponse.fromJson(jsonResponse.body);
}