Deletes all versions of the intent, including the $LATEST version. To delete a specific version of the intent, use the DeleteIntentVersion operation.
You can delete a version of an intent only if it is not referenced. To delete an intent that is referred to in one or more bots (see how-it-works), you must remove those references first.
If you get the ResourceInUseException exception, it provides an example reference that shows where the intent is referenced. To remove the reference to the intent, either update the bot or delete it. If you get the same exception when you attempt to delete the intent again, repeat until the intent has no references and the call to DeleteIntent is successful.
This operation requires permission for the lex:DeleteIntent action.
Parameters:
-
name
(IntentName)
–
The name of the intent. 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_intent(
self,
name: "capo_lex_model_building_service.types.intent_name.IntentName",
*,
config_overrides: Optional[LexModelBuildingServiceClientConfig] = None,
) -> None:
"""<p>Deletes all versions of the intent, including the <code>$LATEST</code> version. To delete a specific version of the intent, use the <a>DeleteIntentVersion</a> operation.</p> <p> You can delete a version of an intent only if it is not referenced. To delete an intent that is referred to in one or more bots (see <a>how-it-works</a>), you must remove those references first. </p> <note> <p> If you get the <code>ResourceInUseException</code> exception, it provides an example reference that shows where the intent is referenced. To remove the reference to the intent, either update the bot or delete it. If you get the same exception when you attempt to delete the intent again, repeat until the intent has no references and the call to <code>DeleteIntent</code> is successful. </p> </note> <p> This operation requires permission for the <code>lex:DeleteIntent</code> action. </p>
Args:
name: <p>The name of the intent. 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_intent_request.DeleteIntentRequest]",
) -> OperationResponse[None]:
import capo_lex_model_building_service._operations.aws_deep_sense_model_building_service.delete_intent
output, http_response = (
capo_lex_model_building_service._operations.aws_deep_sense_model_building_service.delete_intent.delete_intent(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("DeleteIntent")
)
input_: capo_lex_model_building_service.types.delete_intent_request.DeleteIntentRequest = {
"name": name
}
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|