createDataSource method

Future<CreateDataSourceResponse> createDataSource({
  1. required String awsAccountId,
  2. required String dataSourceId,
  3. required String name,
  4. required DataSourceType type,
  5. DataSourceCredentials? credentials,
  6. DataSourceParameters? dataSourceParameters,
  7. List<String>? folderArns,
  8. List<ResourcePermission>? permissions,
  9. SslProperties? sslProperties,
  10. List<Tag>? tags,
  11. VpcConnectionProperties? vpcConnectionProperties,
})

Creates a data source.

May throw AccessDeniedException. May throw ConflictException. May throw CustomerManagedKeyUnavailableException. May throw InternalFailureException. May throw InvalidParameterValueException. May throw LimitExceededException. May throw ResourceExistsException. May throw ResourceNotFoundException. May throw ThrottlingException.

Parameter awsAccountId : The Amazon Web Services account ID.

Parameter dataSourceId : An ID for the data source. This ID is unique per Amazon Web Services Region for each Amazon Web Services account.

Parameter name : A display name for the data source.

Parameter type : The type of the data source. To return a list of all data sources, use ListDataSources.

Use AMAZON_ELASTICSEARCH for Amazon OpenSearch Service.

Parameter credentials : The credentials Amazon Quick Sight that uses to connect to your underlying source. Currently, only credentials based on user name and password are supported.

Parameter dataSourceParameters : The parameters that Amazon Quick Sight uses to connect to your underlying source.

Parameter folderArns : When you create the data source, Amazon Quick Sight adds the data source to these folders.

Parameter permissions : A list of resource permissions on the data source.

Parameter sslProperties : Secure Socket Layer (SSL) properties that apply when Amazon Quick Sight connects to your underlying source.

Parameter tags : Contains a map of the key-value pairs for the resource tag or tags assigned to the data source.

Parameter vpcConnectionProperties : Use this parameter only when you want Amazon Quick Sight to use a VPC connection when connecting to your underlying source.

Implementation

Future<CreateDataSourceResponse> createDataSource({
  required String awsAccountId,
  required String dataSourceId,
  required String name,
  required DataSourceType type,
  DataSourceCredentials? credentials,
  DataSourceParameters? dataSourceParameters,
  List<String>? folderArns,
  List<ResourcePermission>? permissions,
  SslProperties? sslProperties,
  List<Tag>? tags,
  VpcConnectionProperties? vpcConnectionProperties,
}) async {
  final $payload = <String, dynamic>{
    'DataSourceId': dataSourceId,
    'Name': name,
    'Type': type.value,
    if (credentials != null) 'Credentials': credentials,
    if (dataSourceParameters != null)
      'DataSourceParameters': dataSourceParameters,
    if (folderArns != null) 'FolderArns': folderArns,
    if (permissions != null) 'Permissions': permissions,
    if (sslProperties != null) 'SslProperties': sslProperties,
    if (tags != null) 'Tags': tags,
    if (vpcConnectionProperties != null)
      'VpcConnectionProperties': vpcConnectionProperties,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/accounts/${Uri.encodeComponent(awsAccountId)}/data-sources',
    exceptionFnMap: _exceptionFns,
  );
  return CreateDataSourceResponse.fromJson(response);
}