listDiscoveredResources method

Future<ListDiscoveredResourcesResponse> listDiscoveredResources({
  1. required ResourceType resourceType,
  2. bool? includeDeletedResources,
  3. int? limit,
  4. String? nextToken,
  5. List<String>? resourceIds,
  6. String? resourceName,
})

Returns a list of resource resource identifiers for the specified resource types for the resources of that type. A resource identifier includes the resource type, ID, and (if available) the custom resource name.

The results consist of resources that Config has discovered, including those that Config is not currently recording. You can narrow the results to include only resources that have specific resource IDs or a resource name.

When a CloudFormation stack fails to create (for example, it enters the ROLLBACK_FAILED state), Config does not record a configuration item (CI) for that stack. Configuration items are only recorded for stacks that reach the following states:

  • CREATE_COMPLETE
  • UPDATE_COMPLETE
  • UPDATE_ROLLBACK_COMPLETE
  • UPDATE_ROLLBACK_FAILED
  • DELETE_FAILED
  • DELETE_COMPLETE
Because no CI is created for a failed stack creation, you won't see configuration history for that stack in Config, even after the stack is deleted. This helps make sure that Config only tracks resources that were successfully provisioned.

May throw InvalidLimitException. May throw InvalidNextTokenException. May throw NoAvailableConfigurationRecorderException. May throw ValidationException.

Parameter resourceType : The type of resources that you want Config to list in the response.

Parameter includeDeletedResources : Specifies whether Config includes deleted resources in the results. By default, deleted resources are not included.

Parameter limit : The maximum number of resource identifiers returned on each page. The default is 100. You cannot specify a number greater than 100. If you specify 0, 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.

Parameter resourceIds : The IDs of only those resources that you want Config to list in the response. If you do not specify this parameter, Config lists all resources of the specified type that it has discovered. You can list a minimum of 1 resourceID and a maximum of 20 resourceIds.

Parameter resourceName : The custom name of only those resources that you want Config to list in the response. If you do not specify this parameter, Config lists all resources of the specified type that it has discovered.

Implementation

Future<ListDiscoveredResourcesResponse> listDiscoveredResources({
  required ResourceType resourceType,
  bool? includeDeletedResources,
  int? limit,
  String? nextToken,
  List<String>? resourceIds,
  String? resourceName,
}) async {
  _s.validateNumRange(
    'limit',
    limit,
    0,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'StarlingDoveService.ListDiscoveredResources'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'resourceType': resourceType.value,
      if (includeDeletedResources != null)
        'includeDeletedResources': includeDeletedResources,
      if (limit != null) 'limit': limit,
      if (nextToken != null) 'nextToken': nextToken,
      if (resourceIds != null) 'resourceIds': resourceIds,
      if (resourceName != null) 'resourceName': resourceName,
    },
  );

  return ListDiscoveredResourcesResponse.fromJson(jsonResponse.body);
}