Skip to content

delete_stream

delete_stream(
    stream_arn: ResourceARN,
    *,
    config_overrides: Optional[KinesisVideoClientConfig] = None,
    current_version: Optional[Version] = None,
) -> DeleteStreamOutput

Deletes a Kinesis video stream and the data contained in the stream.

This method marks the stream for deletion, and makes the data in the stream inaccessible immediately.

To ensure that you have the latest version of the stream before deleting it, you can specify the stream version. Kinesis Video Streams assigns a version to each stream. When you update a stream, Kinesis Video Streams assigns a new version number. To get the latest stream version, use the DescribeStream API.

This operation requires permission for the KinesisVideo:DeleteStream action.

Parameters:

  • stream_arn (ResourceARN) –

    The Amazon Resource Name (ARN) of the stream that you want to delete.

  • current_version (Optional[Version], default: None ) –

    Optional: The version of the stream that you want to delete.

    Specify the version as a safeguard to ensure that your are deleting the correct stream. To get the stream version, use the DescribeStream API.

    If not specified, only the CreationTime is checked before deleting the stream.

Raises:

  • ClientLimitExceededException –

    Kinesis Video Streams has throttled the request because you have exceeded the limit of allowed client calls. Try making the call later.

  • InvalidArgumentException –

    The value for this input parameter is invalid.

  • NotAuthorizedException –

    The caller is not authorized to perform this operation.

  • ResourceInUseException –

    When the input StreamARN or ChannelARN in CLOUD_STORAGE_MODE is already mapped to a different Kinesis Video Stream resource, or if the provided input StreamARN or ChannelARN is not in Active status, try one of the following :

    1. The DescribeMediaStorageConfiguration API to determine what the stream given channel is mapped to.

    2. The DescribeMappedResourceConfiguration API to determine the channel that the given stream is mapped to.

    3. The DescribeStream or DescribeSignalingChannel API to determine the status of the resource.

  • ResourceNotFoundException –

    Amazon Kinesis Video Streams can't find the stream that you specified.

  • VersionMismatchException –

    The stream version that you specified is not the latest version. To get the latest version, use the DescribeStream API.

  • UnknownServiceError –

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

Source code in docs_src/capo_kinesis_video/_services/kinesis_video.py
def delete_stream(
    self,
    stream_arn: "capo_kinesis_video.types.resource_arn.ResourceARN",
    *,
    config_overrides: Optional[KinesisVideoClientConfig] = None,
    current_version: Optional["capo_kinesis_video.types.version.Version"] = None,
) -> "capo_kinesis_video.types.delete_stream_output.DeleteStreamOutput":
    """<p>Deletes a Kinesis video stream and the data contained in the stream. </p> <p>This method marks the stream for deletion, and makes the data in the stream inaccessible immediately.</p> <p> </p> <p> To ensure that you have the latest version of the stream before deleting it, you can specify the stream version. Kinesis Video Streams assigns a version to each stream. When you update a stream, Kinesis Video Streams assigns a new version number. To get the latest stream version, use the <code>DescribeStream</code> API. </p> <p>This operation requires permission for the <code>KinesisVideo:DeleteStream</code> action.</p>

    Args:
        stream_arn: <p>The Amazon Resource Name (ARN) of the stream that you want to delete. </p>
        current_version: <p>Optional: The version of the stream that you want to delete. </p> <p>Specify the version as a safeguard to ensure that your are deleting the correct stream. To get the stream version, use the <code>DescribeStream</code> API.</p> <p>If not specified, only the <code>CreationTime</code> is checked before deleting the stream.</p>

    Raises:
        capo_kinesis_video.errors.client_limit_exceeded_exception.ClientLimitExceededException: <p>Kinesis Video Streams has throttled the request because you have exceeded the limit of allowed client calls. Try making the call later.</p>
        capo_kinesis_video.errors.invalid_argument_exception.InvalidArgumentException: <p>The value for this input parameter is invalid.</p>
        capo_kinesis_video.errors.not_authorized_exception.NotAuthorizedException: <p>The caller is not authorized to perform this operation.</p>
        capo_kinesis_video.errors.resource_in_use_exception.ResourceInUseException: <p>When the input <code>StreamARN</code> or <code>ChannelARN</code> in <code>CLOUD_STORAGE_MODE</code> is already mapped to a different Kinesis Video Stream resource, or if the provided input <code>StreamARN</code> or <code>ChannelARN</code> is not in Active status, try one of the following : </p> <ol> <li> <p>The <code>DescribeMediaStorageConfiguration</code> API to determine what the stream given channel is mapped to. </p> </li> <li> <p>The <code>DescribeMappedResourceConfiguration</code> API to determine the channel that the given stream is mapped to. </p> </li> <li> <p>The <code>DescribeStream</code> or <code>DescribeSignalingChannel</code> API to determine the status of the resource. </p> </li> </ol>
        capo_kinesis_video.errors.resource_not_found_exception.ResourceNotFoundException: <p>Amazon Kinesis Video Streams can't find the stream that you specified.</p>
        capo_kinesis_video.errors.version_mismatch_exception.VersionMismatchException: <p>The stream version that you specified is not the latest version. To get the latest version, use the <a href="https://docs.aws.amazon.com/kinesisvideostreams/latest/dg/API_DescribeStream.html">DescribeStream</a> API.</p>
        capo_kinesis_video.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_kinesis_video.types.delete_stream_input.DeleteStreamInput]",
    ) -> OperationResponse[
        "capo_kinesis_video.types.delete_stream_output.DeleteStreamOutput"
    ]:
        import capo_kinesis_video._operations.kinesis_video_20170930.delete_stream

        output, http_response = (
            capo_kinesis_video._operations.kinesis_video_20170930.delete_stream.delete_stream(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteStream")
    )
    input_: capo_kinesis_video.types.delete_stream_input.DeleteStreamInput = {
        "stream_arn": stream_arn
    }
    if current_version is not None:
        input_["current_version"] = current_version

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