Skip to content

update_data_retention async

update_data_retention(
    current_version: Version,
    operation: UpdateDataRetentionOperation,
    data_retention_change_in_hours: DataRetentionChangeInHours,
    *,
    config_overrides: Optional[AsyncKinesisVideoClientConfig] = None,
    stream_name: Optional[StreamName] = None,
    stream_arn: Optional[ResourceARN] = None,
) -> UpdateDataRetentionOutput

Increases or decreases the stream's data retention period by the value that you specify. To indicate whether you want to increase or decrease the data retention period, specify the Operation parameter in the request body. In the request, you must specify either the StreamName or the StreamARN.

This operation requires permission for the KinesisVideo:UpdateDataRetention action.

Changing the data retention period affects the data in the stream as follows:

  • If the data retention period is increased, existing data is retained for the new retention period. For example, if the data retention period is increased from one hour to seven hours, all existing data is retained for seven hours.

  • If the data retention period is decreased, existing data is retained for the new retention period. For example, if the data retention period is decreased from seven hours to one hour, all existing data is retained for one hour, and any data older than one hour is deleted immediately.

Parameters:

  • stream_name (Optional[StreamName], default: None ) –

    The name of the stream whose retention period you want to change.

  • stream_arn (Optional[ResourceARN], default: None ) –

    The Amazon Resource Name (ARN) of the stream whose retention period you want to change.

  • current_version (Version) –

    The version of the stream whose retention period you want to change. To get the version, call either the DescribeStream or the ListStreams API.

  • operation (UpdateDataRetentionOperation) –

    Indicates whether you want to increase or decrease the retention period.

  • data_retention_change_in_hours (DataRetentionChangeInHours) –

    The number of hours to adjust the current retention by. The value you specify is added to or subtracted from the current value, depending on the operation.

    The minimum value for data retention is 0 and the maximum value is 87600 (ten years).

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/async_kinesis_video.py
async def update_data_retention(
    self,
    current_version: "capo_kinesis_video.types.version.Version",
    operation: "capo_kinesis_video.types.update_data_retention_operation.UpdateDataRetentionOperation",
    data_retention_change_in_hours: "capo_kinesis_video.types.data_retention_change_in_hours.DataRetentionChangeInHours",
    *,
    config_overrides: Optional[AsyncKinesisVideoClientConfig] = None,
    stream_name: Optional["capo_kinesis_video.types.stream_name.StreamName"] = None,
    stream_arn: Optional[
        "capo_kinesis_video.types.resource_arn.ResourceARN"
    ] = None,
) -> "capo_kinesis_video.types.update_data_retention_output.UpdateDataRetentionOutput":
    """<p>Increases or decreases the stream's data retention period by the value that you specify. To indicate whether you want to increase or decrease the data retention period, specify the <code>Operation</code> parameter in the request body. In the request, you must specify either the <code>StreamName</code> or the <code>StreamARN</code>. </p> <p>This operation requires permission for the <code>KinesisVideo:UpdateDataRetention</code> action.</p> <p>Changing the data retention period affects the data in the stream as follows:</p> <ul> <li> <p>If the data retention period is increased, existing data is retained for the new retention period. For example, if the data retention period is increased from one hour to seven hours, all existing data is retained for seven hours.</p> </li> <li> <p>If the data retention period is decreased, existing data is retained for the new retention period. For example, if the data retention period is decreased from seven hours to one hour, all existing data is retained for one hour, and any data older than one hour is deleted immediately.</p> </li> </ul>

    Args:
        stream_name: <p>The name of the stream whose retention period you want to change.</p>
        stream_arn: <p>The Amazon Resource Name (ARN) of the stream whose retention period you want to change.</p>
        current_version: <p>The version of the stream whose retention period you want to change. To get the version, call either the <code>DescribeStream</code> or the <code>ListStreams</code> API.</p>
        operation: <p>Indicates whether you want to increase or decrease the retention period.</p>
        data_retention_change_in_hours: <p>The number of hours to adjust the current retention by. The value you specify is added to or subtracted from the current value, depending on the <code>operation</code>.</p> <p>The minimum value for data retention is 0 and the maximum value is 87600 (ten years).</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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_kinesis_video.types.update_data_retention_input.UpdateDataRetentionInput]",
    ) -> AsyncOperationResponse[
        "capo_kinesis_video.types.update_data_retention_output.UpdateDataRetentionOutput"
    ]:
        import capo_kinesis_video._operations.kinesis_video_20170930.update_data_retention

        (
            output,
            http_response,
        ) = await capo_kinesis_video._operations.kinesis_video_20170930.update_data_retention.async_update_data_retention(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateDataRetention")
    )
    input_: capo_kinesis_video.types.update_data_retention_input.UpdateDataRetentionInput = {
        "current_version": current_version,
        "operation": operation,
        "data_retention_change_in_hours": data_retention_change_in_hours,
    }
    if stream_name is not None:
        input_["stream_name"] = stream_name
    if stream_arn is not None:
        input_["stream_arn"] = stream_arn

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