Skip to content

update_stream_mode

update_stream_mode(
    stream_arn: StreamARN,
    stream_mode_details: StreamModeDetails,
    *,
    config_overrides: Optional[KinesisClientConfig] = None,
    stream_id: Optional[StreamId] = None,
    warm_throughput_mi_bps: Optional[NaturalIntegerObject] = None,
) -> None

Updates the capacity mode of the data stream. Currently, in Kinesis Data Streams, you can choose between an on-demand capacity mode and a provisioned capacity mode for your data stream.

If you'd still like to proactively scale your on-demand data stream’s capacity, you can unlock the warm throughput feature for on-demand data streams by enabling MinimumThroughputBillingCommitment for your account. Once your account has MinimumThroughputBillingCommitment enabled, you can specify the warm throughput in MiB per second that your stream can support in writes.

Parameters:

  • stream_arn (StreamARN) –

    Specifies the ARN of the data stream whose capacity mode you want to update.

  • stream_id (Optional[StreamId], default: None ) –

    Not Implemented. Reserved for future use.

  • stream_mode_details (StreamModeDetails) –

    Specifies the capacity mode to which you want to set your data stream. Currently, in Kinesis Data Streams, you can choose between an on-demand capacity mode and a provisioned capacity mode for your data streams.

  • warm_throughput_mi_bps (Optional[NaturalIntegerObject], default: None ) –

    The target warm throughput in MB/s that the stream should be scaled to handle. This represents the throughput capacity that will be immediately available for write operations. This field is only valid when the stream mode is being updated to on-demand.

Raises:

  • InvalidArgumentException –

    A specified parameter exceeds its restrictions, is not supported, or can't be used. For more information, see the returned message.

  • LimitExceededException –

    The requested resource exceeds the maximum number allowed, or the number of concurrent stream requests exceeds the maximum number allowed.

  • ResourceInUseException –

    The resource is not available for this operation. For successful operation, the resource must be in the ACTIVE state.

  • ResourceNotFoundException –

    The requested resource could not be found. The stream might not be specified correctly.

  • ValidationException –

    Specifies that you tried to invoke this API for a data stream with the on-demand capacity mode. This API is only supported for data streams with the provisioned capacity mode.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_kinesis/_services/kinesis.py
def update_stream_mode(
    self,
    stream_arn: "capo_kinesis.types.stream_arn.StreamARN",
    stream_mode_details: "capo_kinesis.types.stream_mode_details.StreamModeDetails",
    *,
    config_overrides: Optional[KinesisClientConfig] = None,
    stream_id: Optional["capo_kinesis.types.stream_id.StreamId"] = None,
    warm_throughput_mi_bps: Optional[
        "capo_kinesis.types.natural_integer_object.NaturalIntegerObject"
    ] = None,
) -> None:
    """<p> Updates the capacity mode of the data stream. Currently, in Kinesis Data Streams, you can choose between an <b>on-demand</b> capacity mode and a <b>provisioned</b> capacity mode for your data stream. </p> <p>If you'd still like to proactively scale your on-demand data stream’s capacity, you can unlock the warm throughput feature for on-demand data streams by enabling <code>MinimumThroughputBillingCommitment</code> for your account. Once your account has <code>MinimumThroughputBillingCommitment</code> enabled, you can specify the warm throughput in MiB per second that your stream can support in writes.</p>

    Args:
        stream_arn: <p> Specifies the ARN of the data stream whose capacity mode you want to update. </p>
        stream_id: <p>Not Implemented. Reserved for future use.</p>
        stream_mode_details: <p> Specifies the capacity mode to which you want to set your data stream. Currently, in Kinesis Data Streams, you can choose between an <b>on-demand</b> capacity mode and a <b>provisioned</b> capacity mode for your data streams. </p>
        warm_throughput_mi_bps: <p>The target warm throughput in MB/s that the stream should be scaled to handle. This represents the throughput capacity that will be immediately available for write operations. This field is only valid when the stream mode is being updated to on-demand.</p>

    Raises:
        capo_kinesis.errors.invalid_argument_exception.InvalidArgumentException: <p>A specified parameter exceeds its restrictions, is not supported, or can't be used. For more information, see the returned message.</p>
        capo_kinesis.errors.limit_exceeded_exception.LimitExceededException: <p>The requested resource exceeds the maximum number allowed, or the number of concurrent stream requests exceeds the maximum number allowed. </p>
        capo_kinesis.errors.resource_in_use_exception.ResourceInUseException: <p>The resource is not available for this operation. For successful operation, the resource must be in the <code>ACTIVE</code> state.</p>
        capo_kinesis.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource could not be found. The stream might not be specified correctly.</p>
        capo_kinesis.errors.validation_exception.ValidationException: <p>Specifies that you tried to invoke this API for a data stream with the on-demand capacity mode. This API is only supported for data streams with the provisioned capacity mode. </p>
        capo_kinesis.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_kinesis.types.update_stream_mode_input.UpdateStreamModeInput]",
    ) -> OperationResponse[None]:
        import capo_kinesis._operations.kinesis_20131202.update_stream_mode

        output, http_response = (
            capo_kinesis._operations.kinesis_20131202.update_stream_mode.update_stream_mode(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateStreamMode")
    )
    input_: capo_kinesis.types.update_stream_mode_input.UpdateStreamModeInput = {
        "stream_arn": stream_arn,
        "stream_mode_details": stream_mode_details,
    }
    if stream_id is not None:
        input_["stream_id"] = stream_id
    if warm_throughput_mi_bps is not None:
        input_["warm_throughput_mi_bps"] = warm_throughput_mi_bps

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output