createStream method

Future<CreateStreamOutput> createStream({
  1. required String clusterIdentifier,
  2. required StreamFormat format,
  3. required StreamOrdering ordering,
  4. required TargetDefinition targetDefinition,
  5. String? clientToken,
  6. Map<String, String>? tags,
})

Creates a new change data capture (CDC) stream for a cluster. The stream captures database changes and delivers them to the specified target destination.

Required permissions

dsql:CreateStream
Permission to create a new stream.

Resources: arn:aws:dsql:region:account-id:cluster/cluster-id

iam:PassRole
Permission to pass the IAM role specified in the target definition to the service.

Resources: ARN of the IAM role specified in targetDefinition.kinesis.roleArn

kms:Decrypt
Required when the cluster uses a customer managed KMS key (CMK). Permission to decrypt data using the cluster's CMK.

Resources: ARN of the KMS key used by the cluster

May throw ConflictException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ValidationException.

Parameter clusterIdentifier : The ID of the cluster for which to create the stream.

Parameter format : The format of the stream records.

Parameter ordering : The ordering mode for the stream. Determines how change events are ordered when delivered to the target.

Parameter targetDefinition : The target destination configuration for the stream. Contains Kinesis stream configuration including stream ARN and IAM role ARN.

Parameter clientToken : A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, the subsequent retries with the same client token return the result from the original successful request and they have no additional effect.

If you don't specify a client token, the Amazon Web Services SDK automatically generates one.

Parameter tags : A map of key and value pairs to use to tag your stream.

Implementation

Future<CreateStreamOutput> createStream({
  required String clusterIdentifier,
  required StreamFormat format,
  required StreamOrdering ordering,
  required TargetDefinition targetDefinition,
  String? clientToken,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'format': format.value,
    'ordering': ordering.value,
    'targetDefinition': targetDefinition,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/stream/${Uri.encodeComponent(clusterIdentifier)}',
    exceptionFnMap: _exceptionFns,
  );
  return CreateStreamOutput.fromJson(response);
}