Skip to content

create_export async

create_export(
    resource_specification: ExportResourceSpecification,
    file_format: ImportExportFileFormat,
    *,
    config_overrides: Optional[AsyncLexModelsV2ClientConfig] = None,
    file_password: Optional[ImportExportFilePassword] = None,
) -> CreateExportResponse

Creates a zip archive containing the contents of a bot or a bot locale. The archive contains a directory structure that contains JSON files that define the bot.

You can create an archive that contains the complete definition of a bot, or you can specify that the archive contain only the definition of a single bot locale.

For more information about exporting bots, and about the structure of the export archive, see Importing and exporting bots

Parameters:

  • resource_specification (ExportResourceSpecification) –

    Specifies the type of resource to export, either a bot or a bot locale. You can only specify one type of resource to export.

  • file_format (ImportExportFileFormat) –

    The file format of the bot or bot locale definition files.

  • file_password (Optional[ImportExportFilePassword], default: None ) –

    An password to use to encrypt the exported archive. Using a password is optional, but you should encrypt the archive to protect the data in transit between Amazon Lex and your local computer.

Raises:

  • ConflictException –

    The action that you tried to perform couldn't be completed because the resource is in a conflicting state. For example, deleting a bot that is in the CREATING state. Try your request again.

  • InternalServerException –

    The service encountered an unexpected condition. Try your request again.

  • ResourceNotFoundException –

    You asked to describe a resource that doesn't exist. Check the resource that you are requesting and try again.

  • ServiceQuotaExceededException –

    You have reached a quota for your bot.

  • ThrottlingException –

    Your request rate is too high. Reduce the frequency of requests.

  • ValidationException –

    One of the input parameters in your request isn't valid. Check the parameters and try your request again.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_lex_models_v2/_services/async_lex_models_v2.py
async def create_export(
    self,
    resource_specification: "capo_lex_models_v2.types.export_resource_specification.ExportResourceSpecification",
    file_format: "capo_lex_models_v2.types.import_export_file_format.ImportExportFileFormat",
    *,
    config_overrides: Optional[AsyncLexModelsV2ClientConfig] = None,
    file_password: Optional[
        "capo_lex_models_v2.types.import_export_file_password.ImportExportFilePassword"
    ] = None,
) -> "capo_lex_models_v2.types.create_export_response.CreateExportResponse":
    """<p>Creates a zip archive containing the contents of a bot or a bot locale. The archive contains a directory structure that contains JSON files that define the bot.</p> <p>You can create an archive that contains the complete definition of a bot, or you can specify that the archive contain only the definition of a single bot locale.</p> <p>For more information about exporting bots, and about the structure of the export archive, see <a href="https://docs.aws.amazon.com/lexv2/latest/dg/importing-exporting.html"> Importing and exporting bots </a> </p>

    Args:
        resource_specification: <p>Specifies the type of resource to export, either a bot or a bot locale. You can only specify one type of resource to export.</p>
        file_format: <p>The file format of the bot or bot locale definition files.</p>
        file_password: <p>An password to use to encrypt the exported archive. Using a password is optional, but you should encrypt the archive to protect the data in transit between Amazon Lex and your local computer.</p>

    Raises:
        capo_lex_models_v2.errors.conflict_exception.ConflictException: <p>The action that you tried to perform couldn't be completed because the resource is in a conflicting state. For example, deleting a bot that is in the CREATING state. Try your request again. </p>
        capo_lex_models_v2.errors.internal_server_exception.InternalServerException: <p>The service encountered an unexpected condition. Try your request again.</p>
        capo_lex_models_v2.errors.resource_not_found_exception.ResourceNotFoundException: <p>You asked to describe a resource that doesn't exist. Check the resource that you are requesting and try again.</p>
        capo_lex_models_v2.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>You have reached a quota for your bot. </p>
        capo_lex_models_v2.errors.throttling_exception.ThrottlingException: <p>Your request rate is too high. Reduce the frequency of requests.</p>
        capo_lex_models_v2.errors.validation_exception.ValidationException: <p>One of the input parameters in your request isn't valid. Check the parameters and try your request again.</p>
        capo_lex_models_v2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_lex_models_v2.types.create_export_request.CreateExportRequest]",
    ) -> AsyncOperationResponse[
        "capo_lex_models_v2.types.create_export_response.CreateExportResponse"
    ]:
        import capo_lex_models_v2._operations.lex_model_building_service_v2.create_export

        (
            output,
            http_response,
        ) = await capo_lex_models_v2._operations.lex_model_building_service_v2.create_export.async_create_export(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_lex_models_v2.types.create_export_request.CreateExportRequest",
    ) -> dict[str, Any]:
        import capo_lex_models_v2.types.create_export_request

        return capo_lex_models_v2.types.create_export_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateExport", redact_input=_redact_input),
    )
    input_: capo_lex_models_v2.types.create_export_request.CreateExportRequest = {
        "resource_specification": resource_specification,
        "file_format": file_format,
    }
    if file_password is not None:
        input_["file_password"] = file_password

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