Creates a new version of an intent based on the $LATEST version of the intent. If the $LATEST version of this intent hasn't changed since you last updated it, Amazon Lex doesn't create a new version. It returns the last version you created.
You can update only the $LATEST version of the intent. You can't update the numbered versions that you create with the CreateIntentVersion operation.
When you create a version of an intent, Amazon Lex sets the version to 1. Subsequent versions increment by 1. For more information, see versioning-intro.
This operation requires permissions to perform the lex:CreateIntentVersion action.
Parameters:
-
name
(IntentName)
–
The name of the intent that you want to create a new version of. The name is case sensitive.
-
checksum
(Optional[String], default:
None
)
–
Checksum of the $LATEST version of the intent that should be used to create the new version. If you specify a checksum and the $LATEST version of the intent has a different checksum, Amazon Lex returns a PreconditionFailedException exception and doesn't publish a new version. If you don't specify a checksum, Amazon Lex publishes the $LATEST version.
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.
-
PreconditionFailedException
–
The checksum of the resource that you are trying to change does not match the checksum in the request. Check the resource's checksum and try again.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_lex_model_building_service/_services/async_lex_model_building_service.py
| async def create_intent_version(
self,
name: "capo_lex_model_building_service.types.intent_name.IntentName",
*,
config_overrides: Optional[AsyncLexModelBuildingServiceClientConfig] = None,
checksum: Optional[
"capo_lex_model_building_service.types.string.String"
] = None,
) -> "capo_lex_model_building_service.types.create_intent_version_response.CreateIntentVersionResponse":
"""<p>Creates a new version of an intent based on the <code>$LATEST</code> version of the intent. If the <code>$LATEST</code> version of this intent hasn't changed since you last updated it, Amazon Lex doesn't create a new version. It returns the last version you created.</p> <note> <p>You can update only the <code>$LATEST</code> version of the intent. You can't update the numbered versions that you create with the <code>CreateIntentVersion</code> operation.</p> </note> <p> When you create a version of an intent, Amazon Lex sets the version to 1. Subsequent versions increment by 1. For more information, see <a>versioning-intro</a>. </p> <p>This operation requires permissions to perform the <code>lex:CreateIntentVersion</code> action. </p>
Args:
name: <p>The name of the intent that you want to create a new version of. The name is case sensitive. </p>
checksum: <p>Checksum of the <code>$LATEST</code> version of the intent that should be used to create the new version. If you specify a checksum and the <code>$LATEST</code> version of the intent has a different checksum, Amazon Lex returns a <code>PreconditionFailedException</code> exception and doesn't publish a new version. If you don't specify a checksum, Amazon Lex publishes the <code>$LATEST</code> version.</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.precondition_failed_exception.PreconditionFailedException: <p> The checksum of the resource that you are trying to change does not match the checksum in the request. Check the resource's checksum and try again.</p>
capo_lex_model_building_service.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_lex_model_building_service.types.create_intent_version_request.CreateIntentVersionRequest]",
) -> AsyncOperationResponse[
"capo_lex_model_building_service.types.create_intent_version_response.CreateIntentVersionResponse"
]:
import capo_lex_model_building_service._operations.aws_deep_sense_model_building_service.create_intent_version
(
output,
http_response,
) = await capo_lex_model_building_service._operations.aws_deep_sense_model_building_service.create_intent_version.async_create_intent_version(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("CreateIntentVersion")
)
input_: capo_lex_model_building_service.types.create_intent_version_request.CreateIntentVersionRequest = {
"name": name
}
if checksum is not None:
input_["checksum"] = checksum
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|