Skip to content

put_bot_alias async

put_bot_alias(
    name: AliasName,
    bot_version: Version,
    bot_name: BotName,
    *,
    config_overrides: Optional[AsyncLexModelBuildingServiceClientConfig] = None,
    description: Optional[Description] = None,
    checksum: Optional[String] = None,
    conversation_logs: Optional[ConversationLogsRequest] = None,
    tags: Optional[TagList] = None,
) -> PutBotAliasResponse

Creates an alias for the specified version of the bot or replaces an alias for the specified bot. To change the version of the bot that the alias points to, replace the alias. For more information about aliases, see versioning-aliases.

This operation requires permissions for the lex:PutBotAlias action.

Parameters:

  • name (AliasName) –

    The name of the alias. The name is not case sensitive.

  • description (Optional[Description], default: None ) –

    A description of the alias.

  • bot_version (Version) –

    The version of the bot.

  • bot_name (BotName) –

    The name of the bot.

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

    Identifies a specific revision of the $LATEST version.

    When you create a new bot alias, leave the checksum field blank. If you specify a checksum you get a BadRequestException exception.

    When you want to update a bot alias, set the checksum field to the checksum of the most recent revision of the $LATEST version. If you don't specify the checksum field, or if the checksum does not match the $LATEST version, you get a PreconditionFailedException exception.

  • conversation_logs (Optional[ConversationLogsRequest], default: None ) –

    Settings for conversation logs for the alias.

  • tags (Optional[TagList], default: None ) –

    A list of tags to add to the bot alias. You can only add tags when you create an alias, you can't use the PutBotAlias operation to update the tags on a bot alias. To update tags, use the TagResource operation.

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.

  • 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 put_bot_alias(
    self,
    name: "capo_lex_model_building_service.types.alias_name.AliasName",
    bot_version: "capo_lex_model_building_service.types.version.Version",
    bot_name: "capo_lex_model_building_service.types.bot_name.BotName",
    *,
    config_overrides: Optional[AsyncLexModelBuildingServiceClientConfig] = None,
    description: Optional[
        "capo_lex_model_building_service.types.description.Description"
    ] = None,
    checksum: Optional[
        "capo_lex_model_building_service.types.string.String"
    ] = None,
    conversation_logs: Optional[
        "capo_lex_model_building_service.types.conversation_logs_request.ConversationLogsRequest"
    ] = None,
    tags: Optional["capo_lex_model_building_service.types.tag_list.TagList"] = None,
) -> "capo_lex_model_building_service.types.put_bot_alias_response.PutBotAliasResponse":
    """<p>Creates an alias for the specified version of the bot or replaces an alias for the specified bot. To change the version of the bot that the alias points to, replace the alias. For more information about aliases, see <a>versioning-aliases</a>.</p> <p>This operation requires permissions for the <code>lex:PutBotAlias</code> action. </p>

    Args:
        name: <p>The name of the alias. The name is <i>not</i> case sensitive.</p>
        description: <p>A description of the alias.</p>
        bot_version: <p>The version of the bot.</p>
        bot_name: <p>The name of the bot.</p>
        checksum: <p>Identifies a specific revision of the <code>$LATEST</code> version.</p> <p>When you create a new bot alias, leave the <code>checksum</code> field blank. If you specify a checksum you get a <code>BadRequestException</code> exception.</p> <p>When you want to update a bot alias, set the <code>checksum</code> field to the checksum of the most recent revision of the <code>$LATEST</code> version. If you don't specify the <code> checksum</code> field, or if the checksum does not match the <code>$LATEST</code> version, you get a <code>PreconditionFailedException</code> exception.</p>
        conversation_logs: <p>Settings for conversation logs for the alias.</p>
        tags: <p>A list of tags to add to the bot alias. You can only add tags when you create an alias, you can't use the <code>PutBotAlias</code> operation to update the tags on a bot alias. To update tags, use the <code>TagResource</code> operation.</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.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.put_bot_alias_request.PutBotAliasRequest]",
    ) -> AsyncOperationResponse[
        "capo_lex_model_building_service.types.put_bot_alias_response.PutBotAliasResponse"
    ]:
        import capo_lex_model_building_service._operations.aws_deep_sense_model_building_service.put_bot_alias

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PutBotAlias")
    )
    input_: capo_lex_model_building_service.types.put_bot_alias_request.PutBotAliasRequest = {
        "name": name,
        "bot_version": bot_version,
        "bot_name": bot_name,
    }
    if description is not None:
        input_["description"] = description
    if checksum is not None:
        input_["checksum"] = checksum
    if conversation_logs is not None:
        input_["conversation_logs"] = conversation_logs
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output