describeDirectories method

Future<DescribeDirectoriesResult> describeDirectories({
  1. List<String>? directoryIds,
  2. int? limit,
  3. String? nextToken,
})

Obtains information about the directories that belong to this account.

You can retrieve information about specific directories by passing the directory identifiers in the DirectoryIds parameter. Otherwise, all directories that belong to the current account are returned.

This operation supports pagination with the use of the NextToken request and response parameters. If more results are available, the DescribeDirectoriesResult.NextToken member contains a token that you pass in the next call to DescribeDirectories to retrieve the next set of items.

You can also specify a maximum number of return results with the Limit parameter.

May throw EntityDoesNotExistException. May throw InvalidParameterException. May throw InvalidNextTokenException. May throw ClientException. May throw ServiceException.

Parameter directoryIds : A list of identifiers of the directories for which to obtain the information. If this member is null, all directories that belong to the current account are returned.

An empty list results in an InvalidParameterException being thrown.

Parameter limit : The maximum number of items to return. If this value is zero, the maximum number of items is specified by the limitations of the operation.

Parameter nextToken : The DescribeDirectoriesResult.NextToken value from a previous call to DescribeDirectories. Pass null if this is the first call.

Implementation

Future<DescribeDirectoriesResult> describeDirectories({
  List<String>? directoryIds,
  int? limit,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'limit',
    limit,
    0,
    1152921504606846976,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'DirectoryService_20150416.DescribeDirectories'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (directoryIds != null) 'DirectoryIds': directoryIds,
      if (limit != null) 'Limit': limit,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return DescribeDirectoriesResult.fromJson(jsonResponse.body);
}