Deletes a Kinesis data stream and all its shards and data. You must shut down any applications that are operating on the stream before you delete the stream. If an application attempts to operate on a deleted stream, it receives the exception ResourceNotFoundException.
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 the stream is in the ACTIVE state, you can delete it. After a DeleteStream request, the specified stream is in the DELETING state until Kinesis Data Streams completes the deletion.
Note: Kinesis Data Streams might continue to accept data read and write operations, such as PutRecord, PutRecords, and GetRecords, on a stream in the DELETING state until the stream deletion is complete.
When you delete a stream, any shards in that stream are also deleted, and any tags are dissociated from the stream.
You can use the DescribeStreamSummary operation to check the state of the stream, which is returned in StreamStatus.
DeleteStream has a limit of five transactions per second per account.
Parameters:
-
stream_name
(Optional[StreamName], default:
None
)
–
The name of the stream to delete.
-
enforce_consumer_deletion
(Optional[BooleanObject], default:
None
)
–
If this parameter is unset (null) or if you set it to false, and the stream has registered consumers, the call to DeleteStream fails with a ResourceInUseException.
-
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 delete_stream(
self,
*,
config_overrides: Optional[AsyncKinesisClientConfig] = None,
stream_name: Optional["capo_kinesis.types.stream_name.StreamName"] = None,
enforce_consumer_deletion: Optional[
"capo_kinesis.types.boolean_object.BooleanObject"
] = None,
stream_arn: Optional["capo_kinesis.types.stream_arn.StreamARN"] = None,
stream_id: Optional["capo_kinesis.types.stream_id.StreamId"] = None,
) -> None:
"""<p>Deletes a Kinesis data stream and all its shards and data. You must shut down any applications that are operating on the stream before you delete the stream. If an application attempts to operate on a deleted stream, it receives the exception <code>ResourceNotFoundException</code>.</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 the stream is in the <code>ACTIVE</code> state, you can delete it. After a <code>DeleteStream</code> request, the specified stream is in the <code>DELETING</code> state until Kinesis Data Streams completes the deletion.</p> <p> <b>Note:</b> Kinesis Data Streams might continue to accept data read and write operations, such as <a>PutRecord</a>, <a>PutRecords</a>, and <a>GetRecords</a>, on a stream in the <code>DELETING</code> state until the stream deletion is complete.</p> <p>When you delete a stream, any shards in that stream are also deleted, and any tags are dissociated from the stream.</p> <p>You can use the <a>DescribeStreamSummary</a> operation to check the state of the stream, which is returned in <code>StreamStatus</code>.</p> <p> <a>DeleteStream</a> has a limit of five transactions per second per account.</p>
Args:
stream_name: <p>The name of the stream to delete.</p>
enforce_consumer_deletion: <p>If this parameter is unset (<code>null</code>) or if you set it to <code>false</code>, and the stream has registered consumers, the call to <code>DeleteStream</code> fails with a <code>ResourceInUseException</code>. </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.delete_stream_input.DeleteStreamInput]",
) -> AsyncOperationResponse[None]:
import capo_kinesis._operations.kinesis_20131202.delete_stream
(
output,
http_response,
) = await capo_kinesis._operations.kinesis_20131202.delete_stream.async_delete_stream(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("DeleteStream")
)
input_: capo_kinesis.types.delete_stream_input.DeleteStreamInput = {}
if stream_name is not None:
input_["stream_name"] = stream_name
if enforce_consumer_deletion is not None:
input_["enforce_consumer_deletion"] = enforce_consumer_deletion
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
|