addDirectQueryDataSource method
Adds a new data source in Amazon OpenSearch Service so that you can perform direct queries on external data.
May throw BaseException.
May throw DisabledOperationException.
May throw InternalException.
May throw LimitExceededException.
May throw ResourceNotFoundException.
May throw ValidationException.
Parameter dataSourceName :
A unique, user-defined label to identify the data source within your
OpenSearch Service environment.
Parameter dataSourceType :
The supported Amazon Web Services service that you want to use as the
source for direct queries in OpenSearch Service.
Parameter dataSourceAccessPolicy :
An optional IAM access policy document that defines the permissions for
accessing the data source. The policy document must be in valid JSON
format and follow IAM policy syntax.
Parameter description :
An optional text field for providing additional context and details about
the data source.
Parameter openSearchArns :
An optional list of Amazon Resource Names (ARNs) for the OpenSearch
collections that are associated with the direct query data source. This
field is required for CloudWatchLogs and SecurityLake datasource types.
Implementation
Future<AddDirectQueryDataSourceResponse> addDirectQueryDataSource({
required String dataSourceName,
required DirectQueryDataSourceType dataSourceType,
String? dataSourceAccessPolicy,
String? description,
List<String>? openSearchArns,
List<Tag>? tagList,
}) async {
final $payload = <String, dynamic>{
'DataSourceName': dataSourceName,
'DataSourceType': dataSourceType,
if (dataSourceAccessPolicy != null)
'DataSourceAccessPolicy': dataSourceAccessPolicy,
if (description != null) 'Description': description,
if (openSearchArns != null) 'OpenSearchArns': openSearchArns,
if (tagList != null) 'TagList': tagList,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/2021-01-01/opensearch/directQueryDataSource',
exceptionFnMap: _exceptionFns,
);
return AddDirectQueryDataSourceResponse.fromJson(response);
}