Skip to content

create_bot_version async

create_bot_version(
    name: BotName,
    *,
    config_overrides: Optional[AsyncLexModelBuildingServiceClientConfig] = None,
    checksum: Optional[String] = None,
) -> CreateBotVersionResponse

Creates a new version of the bot based on the $LATEST version. If the $LATEST version of this resource hasn't changed since you created the last version, Amazon Lex doesn't create a new version. It returns the last created version.

You can update only the $LATEST version of the bot. You can't update the numbered versions that you create with the CreateBotVersion operation.

When you create the first version of a bot, Amazon Lex sets the version to 1. Subsequent versions increment by 1. For more information, see versioning-intro.

This operation requires permission for the lex:CreateBotVersion action.

Parameters:

  • name (BotName) –

    The name of the bot that you want to create a new version of. The name is case sensitive.

  • checksum (Optional[String], default: None ) –

    Identifies a specific revision of the $LATEST version of the bot. If you specify a checksum and the $LATEST version of the bot has a different checksum, a PreconditionFailedException exception is returned and Amazon Lex 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_bot_version(
    self,
    name: "capo_lex_model_building_service.types.bot_name.BotName",
    *,
    config_overrides: Optional[AsyncLexModelBuildingServiceClientConfig] = None,
    checksum: Optional[
        "capo_lex_model_building_service.types.string.String"
    ] = None,
) -> "capo_lex_model_building_service.types.create_bot_version_response.CreateBotVersionResponse":
    """<p>Creates a new version of the bot based on the <code>$LATEST</code> version. If the <code>$LATEST</code> version of this resource hasn't changed since you created the last version, Amazon Lex doesn't create a new version. It returns the last created version.</p> <note> <p>You can update only the <code>$LATEST</code> version of the bot. You can't update the numbered versions that you create with the <code>CreateBotVersion</code> operation.</p> </note> <p> When you create the first version of a bot, 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 permission for the <code>lex:CreateBotVersion</code> action. </p>

    Args:
        name: <p>The name of the bot that you want to create a new version of. The name is case sensitive. </p>
        checksum: <p>Identifies a specific revision of the <code>$LATEST</code> version of the bot. If you specify a checksum and the <code>$LATEST</code> version of the bot has a different checksum, a <code>PreconditionFailedException</code> exception is returned and Amazon Lex 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_bot_version_request.CreateBotVersionRequest]",
    ) -> AsyncOperationResponse[
        "capo_lex_model_building_service.types.create_bot_version_response.CreateBotVersionResponse"
    ]:
        import capo_lex_model_building_service._operations.aws_deep_sense_model_building_service.create_bot_version

        (
            output,
            http_response,
        ) = await capo_lex_model_building_service._operations.aws_deep_sense_model_building_service.create_bot_version.async_create_bot_version(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateBotVersion")
    )
    input_: capo_lex_model_building_service.types.create_bot_version_request.CreateBotVersionRequest = {
        "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