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<ResourcePermission>? permissions,
  8. SslProperties? sslProperties,
  9. List<Tag>? tags,
  10. VpcConnectionProperties? vpcConnectionProperties,
})

Creates a data source.

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

Parameter awsAccountId : The AWS account ID.

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

Parameter name : A display name for the data source.

Parameter type : The type of the data source. Currently, the supported types for this operation are: ATHENA, AURORA, AURORA_POSTGRESQL, MARIADB, MYSQL, POSTGRESQL, PRESTO, REDSHIFT, S3, SNOWFLAKE, SPARK, SQLSERVER, TERADATA. Use ListDataSources to return a list of all data sources.

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

Parameter dataSourceParameters : The parameters that QuickSight uses to connect to your underlying source.

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

Parameter sslProperties : Secure Socket Layer (SSL) properties that apply when QuickSight 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 QuickSight 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<ResourcePermission>? permissions,
  SslProperties? sslProperties,
  List<Tag>? tags,
  VpcConnectionProperties? vpcConnectionProperties,
}) async {
  ArgumentError.checkNotNull(awsAccountId, 'awsAccountId');
  _s.validateStringLength(
    'awsAccountId',
    awsAccountId,
    12,
    12,
    isRequired: true,
  );
  ArgumentError.checkNotNull(dataSourceId, 'dataSourceId');
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    1,
    128,
    isRequired: true,
  );
  ArgumentError.checkNotNull(type, 'type');
  final $payload = <String, dynamic>{
    'DataSourceId': dataSourceId,
    'Name': name,
    'Type': type.toValue(),
    if (credentials != null) 'Credentials': credentials,
    if (dataSourceParameters != null)
      'DataSourceParameters': dataSourceParameters,
    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);
}