addApplicationReferenceDataSource method

Future<AddApplicationReferenceDataSourceResponse> addApplicationReferenceDataSource({
  1. required String applicationName,
  2. required int currentApplicationVersionId,
  3. required ReferenceDataSource referenceDataSource,
})

Adds a reference data source to an existing SQL-based Kinesis Data Analytics application.

Kinesis Data Analytics reads reference data (that is, an Amazon S3 object) and creates an in-application table within your application. In the request, you provide the source (S3 bucket name and object key name), name of the in-application table to create, and the necessary mapping information that describes how data in an Amazon S3 object maps to columns in the resulting in-application table.

May throw ResourceNotFoundException. May throw ResourceInUseException. May throw InvalidArgumentException. May throw ConcurrentModificationException. May throw InvalidRequestException.

Parameter applicationName : The name of an existing application.

Parameter currentApplicationVersionId : The version of the application for which you are adding the reference data source. You can use the DescribeApplication operation to get the current application version. If the version specified is not the current version, the ConcurrentModificationException is returned.

Parameter referenceDataSource : The reference data source can be an object in your Amazon S3 bucket. Kinesis Data Analytics reads the object and copies the data into the in-application table that is created. You provide an S3 bucket, object key name, and the resulting in-application table that is created.

Implementation

Future<AddApplicationReferenceDataSourceResponse>
    addApplicationReferenceDataSource({
  required String applicationName,
  required int currentApplicationVersionId,
  required ReferenceDataSource referenceDataSource,
}) async {
  ArgumentError.checkNotNull(applicationName, 'applicationName');
  _s.validateStringLength(
    'applicationName',
    applicationName,
    1,
    128,
    isRequired: true,
  );
  ArgumentError.checkNotNull(
      currentApplicationVersionId, 'currentApplicationVersionId');
  _s.validateNumRange(
    'currentApplicationVersionId',
    currentApplicationVersionId,
    1,
    999999999,
    isRequired: true,
  );
  ArgumentError.checkNotNull(referenceDataSource, 'referenceDataSource');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target':
        'KinesisAnalytics_20180523.AddApplicationReferenceDataSource'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ApplicationName': applicationName,
      'CurrentApplicationVersionId': currentApplicationVersionId,
      'ReferenceDataSource': referenceDataSource,
    },
  );

  return AddApplicationReferenceDataSourceResponse.fromJson(
      jsonResponse.body);
}