listDataSources method

Future<ListDataSourcesResponse> listDataSources({
  1. required String indexId,
  2. int? maxResults,
  3. String? nextToken,
})

Lists the data sources that you have created.

May throw ValidationException. May throw ResourceNotFoundException. May throw AccessDeniedException. May throw ThrottlingException. May throw InternalServerException.

Parameter indexId : The identifier of the index that contains the data source.

Parameter maxResults : The maximum number of data sources to return.

Parameter nextToken : If the previous response was incomplete (because there is more data to retrieve), Amazon Kendra returns a pagination token in the response. You can use this pagination token to retrieve the next set of data sources (DataSourceSummaryItems).

Implementation

Future<ListDataSourcesResponse> listDataSources({
  required String indexId,
  int? maxResults,
  String? nextToken,
}) async {
  ArgumentError.checkNotNull(indexId, 'indexId');
  _s.validateStringLength(
    'indexId',
    indexId,
    36,
    36,
    isRequired: true,
  );
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    1,
    800,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSKendraFrontendService.ListDataSources'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'IndexId': indexId,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return ListDataSourcesResponse.fromJson(jsonResponse.body);
}