Increases the Kinesis data stream's retention period, which is the length of time data records are accessible after they are added to the stream. The maximum value of a stream's retention period is 8760 hours (365 days).
When invoking this API, you must use either the StreamARN or the StreamName parameter, or both. It is recommended that you use the StreamARN input parameter when you invoke this API.
If you choose a longer stream retention period, this operation increases the time period during which records that have not yet expired are accessible. However, it does not make previous, expired data (older than the stream's previous retention period) accessible after the operation has been called. For example, if a stream's retention period is set to 24 hours and is increased to 168 hours, any data that is older than 24 hours remains inaccessible to consumer applications.
Parameters:
-
stream_name
(Optional[StreamName], default:
None
)
–
The name of the stream to modify.
-
retention_period_hours
(RetentionPeriodHours)
–
The new retention period of the stream, in hours. Must be more than the current retention period.
-
stream_arn
(Optional[StreamARN], default:
None
)
–
-
stream_id
(Optional[StreamId], default:
None
)
–
Not Implemented. Reserved for future use.
Raises:
-
AccessDeniedException
–
Specifies that you do not have the permissions required to perform this operation.
-
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.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_kinesis/_services/async_kinesis.py
| async def increase_stream_retention_period(
self,
retention_period_hours: "capo_kinesis.types.retention_period_hours.RetentionPeriodHours",
*,
config_overrides: Optional[AsyncKinesisClientConfig] = None,
stream_name: Optional["capo_kinesis.types.stream_name.StreamName"] = None,
stream_arn: Optional["capo_kinesis.types.stream_arn.StreamARN"] = None,
stream_id: Optional["capo_kinesis.types.stream_id.StreamId"] = None,
) -> None:
"""<p>Increases the Kinesis data stream's retention period, which is the length of time data records are accessible after they are added to the stream. The maximum value of a stream's retention period is 8760 hours (365 days).</p> <note> <p>When invoking this API, you must use either the <code>StreamARN</code> or the <code>StreamName</code> parameter, or both. It is recommended that you use the <code>StreamARN</code> input parameter when you invoke this API.</p> </note> <p>If you choose a longer stream retention period, this operation increases the time period during which records that have not yet expired are accessible. However, it does not make previous, expired data (older than the stream's previous retention period) accessible after the operation has been called. For example, if a stream's retention period is set to 24 hours and is increased to 168 hours, any data that is older than 24 hours remains inaccessible to consumer applications.</p>
Args:
stream_name: <p>The name of the stream to modify.</p>
retention_period_hours: <p>The new retention period of the stream, in hours. Must be more than the current retention period.</p>
stream_arn: <p>The ARN of the stream.</p>
stream_id: <p>Not Implemented. Reserved for future use.</p>
Raises:
capo_kinesis.errors.access_denied_exception.AccessDeniedException: <p>Specifies that you do not have the permissions required to perform this operation.</p>
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.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_kinesis.types.increase_stream_retention_period_input.IncreaseStreamRetentionPeriodInput]",
) -> AsyncOperationResponse[None]:
import capo_kinesis._operations.kinesis_20131202.increase_stream_retention_period
(
output,
http_response,
) = await capo_kinesis._operations.kinesis_20131202.increase_stream_retention_period.async_increase_stream_retention_period(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("IncreaseStreamRetentionPeriod")
)
input_: capo_kinesis.types.increase_stream_retention_period_input.IncreaseStreamRetentionPeriodInput = {
"retention_period_hours": retention_period_hours
}
if stream_name is not None:
input_["stream_name"] = stream_name
if stream_arn is not None:
input_["stream_arn"] = stream_arn
if stream_id is not None:
input_["stream_id"] = stream_id
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|