Skip to content

create_stream async

create_stream(
    cluster_identifier: ClusterId,
    target_definition: TargetDefinition,
    ordering: StreamOrdering,
    format: StreamFormat,
    *,
    config_overrides: Optional[AsyncDSQLClientConfig] = None,
    tags: Optional[TagMap] = None,
    client_token: Optional[ClientToken] = None,
) -> CreateStreamOutput

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

Parameters:

  • cluster_identifier (ClusterId) –

    The ID of the cluster for which to create the stream.

  • target_definition (TargetDefinition) –

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

  • ordering (StreamOrdering) –

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

  • format (StreamFormat) –

    The format of the stream records.

  • tags (Optional[TagMap], default: None ) –

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

  • client_token (Optional[ClientToken], default: None ) –

    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.

Raises:

Source code in docs_src/capo_dsql/_services/async_dsql.py
async def create_stream(
    self,
    cluster_identifier: "capo_dsql.types.cluster_id.ClusterId",
    target_definition: "capo_dsql.types.target_definition.TargetDefinition",
    ordering: "capo_dsql.types.stream_ordering.StreamOrdering",
    format: "capo_dsql.types.stream_format.StreamFormat",
    *,
    config_overrides: Optional[AsyncDSQLClientConfig] = None,
    tags: Optional["capo_dsql.types.tag_map.TagMap"] = None,
    client_token: Optional["capo_dsql.types.client_token.ClientToken"] = None,
) -> "capo_dsql.types.create_stream_output.CreateStreamOutput":
    """<p>Creates a new change data capture (CDC) stream for a cluster. The stream captures database changes and delivers them to the specified target destination.</p> <p> <b>Required permissions</b> </p> <dl> <dt>dsql:CreateStream</dt> <dd> <p>Permission to create a new stream.</p> <p>Resources: <code>arn:aws:dsql:region:account-id:cluster/cluster-id</code> </p> </dd> <dt>iam:PassRole</dt> <dd> <p>Permission to pass the IAM role specified in the target definition to the service.</p> <p>Resources: ARN of the IAM role specified in <code>targetDefinition.kinesis.roleArn</code> </p> </dd> <dt>kms:Decrypt</dt> <dd> <p>Required when the cluster uses a customer managed KMS key (CMK). Permission to decrypt data using the cluster's CMK.</p> <p>Resources: ARN of the KMS key used by the cluster</p> </dd> </dl>

    Args:
        cluster_identifier: <p>The ID of the cluster for which to create the stream.</p>
        target_definition: <p>The target destination configuration for the stream. Contains Kinesis stream configuration including stream ARN and IAM role ARN.</p>
        ordering: <p>The ordering mode for the stream. Determines how change events are ordered when delivered to the target.</p>
        format: <p>The format of the stream records.</p>
        tags: <p>A map of key and value pairs to use to tag your stream.</p>
        client_token: <p>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.</p> <p>If you don't specify a client token, the Amazon Web Services SDK automatically generates one.</p>

    Raises:
        capo_dsql.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_dsql.errors.internal_server_exception.InternalServerException: <p>The request processing has failed because of an unknown error, exception or failure.</p>
        capo_dsql.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_dsql.errors.validation_exception.ValidationException: <p>The input failed to satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_dsql.errors.conflict_exception.ConflictException: <p>The submitted action has conflicts.</p>
        capo_dsql.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource could not be found.</p>
        capo_dsql.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The service limit was exceeded.</p>
        capo_dsql.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_dsql.types.create_stream_input.CreateStreamInput]",
    ) -> AsyncOperationResponse[
        "capo_dsql.types.create_stream_output.CreateStreamOutput"
    ]:
        import capo_dsql._operations.dsql.create_stream

        (
            output,
            http_response,
        ) = await capo_dsql._operations.dsql.create_stream.async_create_stream(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateStream")
    )
    input_: capo_dsql.types.create_stream_input.CreateStreamInput = {
        "cluster_identifier": cluster_identifier,
        "target_definition": target_definition,
        "ordering": ordering,
        "format": format,
    }
    if tags is not None:
        input_["tags"] = tags
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output