listDocuments method

Future<ListDocumentsResult> listDocuments({
  1. List<DocumentFilter>? documentFilterList,
  2. List<DocumentKeyValuesFilter>? filters,
  3. int? maxResults,
  4. String? nextToken,
})

Returns all Systems Manager (SSM) documents in the current AWS account and Region. You can limit the results of this request by using a filter.

May throw InternalServerError. May throw InvalidNextToken. May throw InvalidFilterKey.

Parameter documentFilterList : This data type is deprecated. Instead, use Filters.

Parameter filters : One or more DocumentKeyValuesFilter objects. Use a filter to return a more specific list of results. For keys, you can specify one or more key-value pair tags that have been applied to a document. Other valid keys include Owner, Name, PlatformTypes, DocumentType, and TargetType. For example, to return documents you own use Key=Owner,Values=Self. To specify a custom key-value pair, use the format Key=tag:tagName,Values=valueName.

Parameter maxResults : The maximum number of items to return for this call. The call also returns a token that you can specify in a subsequent call to get the next set of results.

Parameter nextToken : The token for the next set of items to return. (You received this token from a previous call.)

Implementation

Future<ListDocumentsResult> listDocuments({
  List<DocumentFilter>? documentFilterList,
  List<DocumentKeyValuesFilter>? filters,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    50,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonSSM.ListDocuments'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (documentFilterList != null)
        'DocumentFilterList': documentFilterList,
      if (filters != null) 'Filters': filters,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return ListDocumentsResult.fromJson(jsonResponse.body);
}