Deletes all versions of the bot, including the $LATEST version. To delete a specific version of the bot, use the DeleteBotVersion operation. The DeleteBot operation doesn't immediately remove the bot schema. Instead, it is marked for deletion and removed later.
Amazon Lex stores utterances indefinitely for improving the ability of your bot to respond to user inputs. These utterances are not removed when the bot is deleted. To remove the utterances, use the DeleteUtterances operation.
If a bot has an alias, you can't delete it. Instead, the DeleteBot operation returns a ResourceInUseException exception that includes a reference to the alias that refers to the bot. To remove the reference to the bot, delete the alias. If you get the same exception again, delete the referring alias until the DeleteBot operation is successful.
This operation requires permissions for the lex:DeleteBot action.
Parameters:
-
name
(BotName)
–
The name of the bot. The name is case sensitive.
Raises:
-
BadRequestException
–
The request is not well formed. For example, a value is invalid or a required field is missing. Check the field values, and try again.
-
ConflictException
–
There was a conflict processing the request. Try your request again.
-
InternalFailureException
–
An internal Amazon Lex error occurred. Try your request again.
-
LimitExceededException
–
The request exceeded a limit. Try your request again.
-
NotFoundException
–
The resource specified in the request was not found. Check the resource and try again.
-
ResourceInUseException
–
The resource that you are attempting to delete is referred to by another resource. Use this information to remove references to the resource that you are trying to delete.
The body of the exception contains a JSON object that describes the resource.
{ "resourceType": BOT | BOTALIAS | BOTCHANNEL | INTENT,
"resourceReference": {
"name": string, "version": string } }
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_lex_model_building_service/_services/lex_model_building_service.py
| def delete_bot(
self,
name: "capo_lex_model_building_service.types.bot_name.BotName",
*,
config_overrides: Optional[LexModelBuildingServiceClientConfig] = None,
) -> None:
"""<p>Deletes all versions of the bot, including the <code>$LATEST</code> version. To delete a specific version of the bot, use the <a>DeleteBotVersion</a> operation. The <code>DeleteBot</code> operation doesn't immediately remove the bot schema. Instead, it is marked for deletion and removed later.</p> <p>Amazon Lex stores utterances indefinitely for improving the ability of your bot to respond to user inputs. These utterances are not removed when the bot is deleted. To remove the utterances, use the <a>DeleteUtterances</a> operation.</p> <p>If a bot has an alias, you can't delete it. Instead, the <code>DeleteBot</code> operation returns a <code>ResourceInUseException</code> exception that includes a reference to the alias that refers to the bot. To remove the reference to the bot, delete the alias. If you get the same exception again, delete the referring alias until the <code>DeleteBot</code> operation is successful.</p> <p>This operation requires permissions for the <code>lex:DeleteBot</code> action.</p>
Args:
name: <p>The name of the bot. The name is case sensitive. </p>
Raises:
capo_lex_model_building_service.errors.bad_request_exception.BadRequestException: <p>The request is not well formed. For example, a value is invalid or a required field is missing. Check the field values, and try again.</p>
capo_lex_model_building_service.errors.conflict_exception.ConflictException: <p> There was a conflict processing the request. Try your request again. </p>
capo_lex_model_building_service.errors.internal_failure_exception.InternalFailureException: <p>An internal Amazon Lex error occurred. Try your request again.</p>
capo_lex_model_building_service.errors.limit_exceeded_exception.LimitExceededException: <p>The request exceeded a limit. Try your request again.</p>
capo_lex_model_building_service.errors.not_found_exception.NotFoundException: <p>The resource specified in the request was not found. Check the resource and try again.</p>
capo_lex_model_building_service.errors.resource_in_use_exception.ResourceInUseException: <p>The resource that you are attempting to delete is referred to by another resource. Use this information to remove references to the resource that you are trying to delete.</p> <p>The body of the exception contains a JSON object that describes the resource.</p> <p> <code>{ "resourceType": BOT | BOTALIAS | BOTCHANNEL | INTENT,</code> </p> <p> <code>"resourceReference": {</code> </p> <p> <code>"name": <i>string</i>, "version": <i>string</i> } }</code> </p>
capo_lex_model_building_service.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_lex_model_building_service.types.delete_bot_request.DeleteBotRequest]",
) -> OperationResponse[None]:
import capo_lex_model_building_service._operations.aws_deep_sense_model_building_service.delete_bot
output, http_response = (
capo_lex_model_building_service._operations.aws_deep_sense_model_building_service.delete_bot.delete_bot(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("DeleteBot")
)
input_: capo_lex_model_building_service.types.delete_bot_request.DeleteBotRequest = {
"name": name
}
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|