streamJournalToKinesis method

Future<StreamJournalToKinesisResponse> streamJournalToKinesis({
  1. required DateTime inclusiveStartTime,
  2. required KinesisConfiguration kinesisConfiguration,
  3. required String ledgerName,
  4. required String roleArn,
  5. required String streamName,
  6. DateTime? exclusiveEndTime,
  7. Map<String, String>? tags,
})

Creates a journal stream for a given Amazon QLDB ledger. The stream captures every document revision that is committed to the ledger's journal and delivers the data to a specified Amazon Kinesis Data Streams resource.

May throw InvalidParameterException. May throw ResourceNotFoundException. May throw ResourcePreconditionNotMetException.

Parameter inclusiveStartTime : The inclusive start date and time from which to start streaming journal data. This parameter must be in ISO 8601 date and time format and in Universal Coordinated Time (UTC). For example: 2019-06-13T21:36:34Z

The InclusiveStartTime cannot be in the future and must be before ExclusiveEndTime.

If you provide an InclusiveStartTime that is before the ledger's CreationDateTime, QLDB effectively defaults it to the ledger's CreationDateTime.

Parameter kinesisConfiguration : The configuration settings of the Kinesis Data Streams destination for your stream request.

Parameter ledgerName : The name of the ledger.

Parameter roleArn : The Amazon Resource Name (ARN) of the IAM role that grants QLDB permissions for a journal stream to write data records to a Kinesis Data Streams resource.

Parameter streamName : The name that you want to assign to the QLDB journal stream. User-defined names can help identify and indicate the purpose of a stream.

Your stream name must be unique among other active streams for a given ledger. Stream names have the same naming constraints as ledger names, as defined in Quotas in Amazon QLDB in the Amazon QLDB Developer Guide.

Parameter exclusiveEndTime : The exclusive date and time that specifies when the stream ends. If you don't define this parameter, the stream runs indefinitely until you cancel it.

The ExclusiveEndTime must be in ISO 8601 date and time format and in Universal Coordinated Time (UTC). For example: 2019-06-13T21:36:34Z

Parameter tags : The key-value pairs to add as tags to the stream that you want to create. Tag keys are case sensitive. Tag values are case sensitive and can be null.

Implementation

Future<StreamJournalToKinesisResponse> streamJournalToKinesis({
  required DateTime inclusiveStartTime,
  required KinesisConfiguration kinesisConfiguration,
  required String ledgerName,
  required String roleArn,
  required String streamName,
  DateTime? exclusiveEndTime,
  Map<String, String>? tags,
}) async {
  ArgumentError.checkNotNull(inclusiveStartTime, 'inclusiveStartTime');
  ArgumentError.checkNotNull(kinesisConfiguration, 'kinesisConfiguration');
  ArgumentError.checkNotNull(ledgerName, 'ledgerName');
  _s.validateStringLength(
    'ledgerName',
    ledgerName,
    1,
    32,
    isRequired: true,
  );
  ArgumentError.checkNotNull(roleArn, 'roleArn');
  _s.validateStringLength(
    'roleArn',
    roleArn,
    20,
    1600,
    isRequired: true,
  );
  ArgumentError.checkNotNull(streamName, 'streamName');
  _s.validateStringLength(
    'streamName',
    streamName,
    1,
    32,
    isRequired: true,
  );
  final $payload = <String, dynamic>{
    'InclusiveStartTime': unixTimestampToJson(inclusiveStartTime),
    'KinesisConfiguration': kinesisConfiguration,
    'RoleArn': roleArn,
    'StreamName': streamName,
    if (exclusiveEndTime != null)
      'ExclusiveEndTime': unixTimestampToJson(exclusiveEndTime),
    if (tags != null) 'Tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/ledgers/${Uri.encodeComponent(ledgerName)}/journal-kinesis-streams',
    exceptionFnMap: _exceptionFns,
  );
  return StreamJournalToKinesisResponse.fromJson(response);
}