Skip to content

create_slot_type_version async

create_slot_type_version(
    name: SlotTypeName,
    *,
    config_overrides: Optional[AsyncLexModelBuildingServiceClientConfig] = None,
    checksum: Optional[String] = None,
) -> CreateSlotTypeVersionResponse

Creates a new version of a slot type based on the $LATEST version of the specified slot type. If the $LATEST version of this resource has not changed since the last version that you created, Amazon Lex doesn't create a new version. It returns the last version that you created.

You can update only the $LATEST version of a slot type. You can't update the numbered versions that you create with the CreateSlotTypeVersion operation.

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

This operation requires permissions for the lex:CreateSlotTypeVersion action.

Parameters:

  • name (SlotTypeName) –

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

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

    Checksum for the $LATEST version of the slot type that you want to publish. If you specify a checksum and the $LATEST version of the slot type has a different checksum, Amazon Lex returns a PreconditionFailedException exception and doesn't publish the 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_slot_type_version(
    self,
    name: "capo_lex_model_building_service.types.slot_type_name.SlotTypeName",
    *,
    config_overrides: Optional[AsyncLexModelBuildingServiceClientConfig] = None,
    checksum: Optional[
        "capo_lex_model_building_service.types.string.String"
    ] = None,
) -> "capo_lex_model_building_service.types.create_slot_type_version_response.CreateSlotTypeVersionResponse":
    """<p>Creates a new version of a slot type based on the <code>$LATEST</code> version of the specified slot type. If the <code>$LATEST</code> version of this resource has not changed since the last version that you created, Amazon Lex doesn't create a new version. It returns the last version that you created. </p> <note> <p>You can update only the <code>$LATEST</code> version of a slot type. You can't update the numbered versions that you create with the <code>CreateSlotTypeVersion</code> operation.</p> </note> <p>When you create a version of a slot type, 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 for the <code>lex:CreateSlotTypeVersion</code> action.</p>

    Args:
        name: <p>The name of the slot type that you want to create a new version for. The name is case sensitive. </p>
        checksum: <p>Checksum for the <code>$LATEST</code> version of the slot type that you want to publish. If you specify a checksum and the <code>$LATEST</code> version of the slot type has a different checksum, Amazon Lex returns a <code>PreconditionFailedException</code> exception and doesn't publish the 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_slot_type_version_request.CreateSlotTypeVersionRequest]",
    ) -> AsyncOperationResponse[
        "capo_lex_model_building_service.types.create_slot_type_version_response.CreateSlotTypeVersionResponse"
    ]:
        import capo_lex_model_building_service._operations.aws_deep_sense_model_building_service.create_slot_type_version

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

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