discoverInputSchema method

Future<DiscoverInputSchemaResponse> discoverInputSchema({
  1. required String serviceExecutionRole,
  2. InputProcessingConfiguration? inputProcessingConfiguration,
  3. InputStartingPositionConfiguration? inputStartingPositionConfiguration,
  4. String? resourceARN,
  5. S3Configuration? s3Configuration,
})

Infers a schema for a SQL-based Kinesis Data Analytics application by evaluating sample records on the specified streaming source (Kinesis data stream or Kinesis Data Firehose delivery stream) or Amazon S3 object. In the response, the operation returns the inferred schema and also the sample records that the operation used to infer the schema.

You can use the inferred schema when configuring a streaming source for your application. When you create an application using the Kinesis Data Analytics console, the console uses this operation to infer a schema and show it in the console user interface.

May throw InvalidArgumentException. May throw UnableToDetectSchemaException. May throw ResourceProvisionedThroughputExceededException. May throw ServiceUnavailableException. May throw InvalidRequestException.

Parameter serviceExecutionRole : The ARN of the role that is used to access the streaming source.

Parameter inputProcessingConfiguration : The InputProcessingConfiguration to use to preprocess the records before discovering the schema of the records.

Parameter inputStartingPositionConfiguration : The point at which you want Kinesis Data Analytics to start reading records from the specified streaming source discovery purposes.

Parameter resourceARN : The Amazon Resource Name (ARN) of the streaming source.

Parameter s3Configuration : Specify this parameter to discover a schema from data in an Amazon S3 object.

Implementation

Future<DiscoverInputSchemaResponse> discoverInputSchema({
  required String serviceExecutionRole,
  InputProcessingConfiguration? inputProcessingConfiguration,
  InputStartingPositionConfiguration? inputStartingPositionConfiguration,
  String? resourceARN,
  S3Configuration? s3Configuration,
}) async {
  ArgumentError.checkNotNull(serviceExecutionRole, 'serviceExecutionRole');
  _s.validateStringLength(
    'serviceExecutionRole',
    serviceExecutionRole,
    1,
    2048,
    isRequired: true,
  );
  _s.validateStringLength(
    'resourceARN',
    resourceARN,
    1,
    2048,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'KinesisAnalytics_20180523.DiscoverInputSchema'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ServiceExecutionRole': serviceExecutionRole,
      if (inputProcessingConfiguration != null)
        'InputProcessingConfiguration': inputProcessingConfiguration,
      if (inputStartingPositionConfiguration != null)
        'InputStartingPositionConfiguration':
            inputStartingPositionConfiguration,
      if (resourceARN != null) 'ResourceARN': resourceARN,
      if (s3Configuration != null) 'S3Configuration': s3Configuration,
    },
  );

  return DiscoverInputSchemaResponse.fromJson(jsonResponse.body);
}