addDataSource method

Future<AddDataSourceResponse> addDataSource({
  1. required DataSourceType dataSourceType,
  2. required String domainName,
  3. required String name,
  4. String? description,
})

Creates a new direct-query data source to the specified domain. For more information, see Creating Amazon OpenSearch Service data source integrations with Amazon S3.

May throw BaseException. May throw DependencyFailureException. May throw DisabledOperationException. May throw InternalException. May throw LimitExceededException. May throw ResourceNotFoundException. May throw ValidationException.

Parameter dataSourceType : The type of data source.

Parameter domainName : The name of the domain to add the data source to.

Parameter name : A name for the data source.

Parameter description : A description of the data source.

Implementation

Future<AddDataSourceResponse> addDataSource({
  required DataSourceType dataSourceType,
  required String domainName,
  required String name,
  String? description,
}) async {
  final $payload = <String, dynamic>{
    'DataSourceType': dataSourceType,
    'Name': name,
    if (description != null) 'Description': description,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/2021-01-01/opensearch/domain/${Uri.encodeComponent(domainName)}/dataSource',
    exceptionFnMap: _exceptionFns,
  );
  return AddDataSourceResponse.fromJson(response);
}