discoverInputSchema method

Future<DiscoverInputSchemaResponse> discoverInputSchema({
  1. InputProcessingConfiguration? inputProcessingConfiguration,
  2. InputStartingPositionConfiguration? inputStartingPositionConfiguration,
  3. String? resourceARN,
  4. String? roleARN,
  5. S3Configuration? s3Configuration,
})
Infers a schema by evaluating sample records on the specified streaming source (Amazon Kinesis stream or Amazon Kinesis Firehose delivery stream) or 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. For conceptual information, see Configuring Application Input. Note that when you create an application using the Amazon Kinesis Analytics console, the console uses this operation to infer a schema and show it in the console user interface.

This operation requires permissions to perform the kinesisanalytics:DiscoverInputSchema action.

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

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

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

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

Parameter roleARN : ARN of the IAM role that Amazon Kinesis Analytics can assume to access the stream on your behalf.

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

Implementation

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

  return DiscoverInputSchemaResponse.fromJson(jsonResponse.body);
}