Skip to content

import_terminology

import_terminology(
    name: ResourceName,
    merge_strategy: MergeStrategy,
    terminology_data: TerminologyData,
    *,
    config_overrides: Optional[TranslateClientConfig] = None,
    description: Optional[Description] = None,
    encryption_key: Optional[EncryptionKey] = None,
    tags: Optional[TagList] = None,
) -> ImportTerminologyResponse

Creates or updates a custom terminology, depending on whether one already exists for the given terminology name. Importing a terminology with the same name as an existing one will merge the terminologies based on the chosen merge strategy. The only supported merge strategy is OVERWRITE, where the imported terminology overwrites the existing terminology of the same name.

If you import a terminology that overwrites an existing one, the new terminology takes up to 10 minutes to fully propagate. After that, translations have access to the new terminology.

Parameters:

  • name (ResourceName) –

    The name of the custom terminology being imported.

  • merge_strategy (MergeStrategy) –

    The merge strategy of the custom terminology being imported. Currently, only the OVERWRITE merge strategy is supported. In this case, the imported terminology will overwrite an existing terminology of the same name.

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

    The description of the custom terminology being imported.

  • terminology_data (TerminologyData) –

    The terminology data for the custom terminology being imported.

  • encryption_key (Optional[EncryptionKey], default: None ) –

    The encryption key for the custom terminology being imported.

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

    Tags to be associated with this resource. A tag is a key-value pair that adds metadata to a resource. Each tag key for the resource must be unique. For more information, see Tagging your resources.

Raises:

  • ConcurrentModificationException –

    Another modification is being made. That modification must complete before you can make your change.

  • InternalServerException –

    An internal server error occurred. Retry your request.

  • InvalidParameterValueException –

    The value of the parameter is not valid. Review the value of the parameter you are using to correct it, and then retry your operation.

  • LimitExceededException –

    The specified limit has been exceeded. Review your request and retry it with a quantity below the stated limit.

  • TooManyRequestsException –

    You have made too many requests within a short period of time. Wait for a short time and then try your request again.

  • TooManyTagsException –

    You have added too many tags to this resource. The maximum is 50 tags.

  • UnknownServiceError –

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

Source code in docs_src/capo_translate/_services/translate.py
def import_terminology(
    self,
    name: "capo_translate.types.resource_name.ResourceName",
    merge_strategy: "capo_translate.types.merge_strategy.MergeStrategy",
    terminology_data: "capo_translate.types.terminology_data.TerminologyData",
    *,
    config_overrides: Optional[TranslateClientConfig] = None,
    description: Optional["capo_translate.types.description.Description"] = None,
    encryption_key: Optional[
        "capo_translate.types.encryption_key.EncryptionKey"
    ] = None,
    tags: Optional["capo_translate.types.tag_list.TagList"] = None,
) -> "capo_translate.types.import_terminology_response.ImportTerminologyResponse":
    """<p>Creates or updates a custom terminology, depending on whether one already exists for the given terminology name. Importing a terminology with the same name as an existing one will merge the terminologies based on the chosen merge strategy. The only supported merge strategy is OVERWRITE, where the imported terminology overwrites the existing terminology of the same name.</p> <p>If you import a terminology that overwrites an existing one, the new terminology takes up to 10 minutes to fully propagate. After that, translations have access to the new terminology.</p>

    Args:
        name: <p>The name of the custom terminology being imported.</p>
        merge_strategy: <p>The merge strategy of the custom terminology being imported. Currently, only the OVERWRITE merge strategy is supported. In this case, the imported terminology will overwrite an existing terminology of the same name.</p>
        description: <p>The description of the custom terminology being imported.</p>
        terminology_data: <p>The terminology data for the custom terminology being imported.</p>
        encryption_key: <p>The encryption key for the custom terminology being imported.</p>
        tags: <p>Tags to be associated with this resource. A tag is a key-value pair that adds metadata to a resource. Each tag key for the resource must be unique. For more information, see <a href="https://docs.aws.amazon.com/translate/latest/dg/tagging.html"> Tagging your resources</a>.</p>

    Raises:
        capo_translate.errors.concurrent_modification_exception.ConcurrentModificationException: <p>Another modification is being made. That modification must complete before you can make your change.</p>
        capo_translate.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry your request.</p>
        capo_translate.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>The value of the parameter is not valid. Review the value of the parameter you are using to correct it, and then retry your operation.</p>
        capo_translate.errors.limit_exceeded_exception.LimitExceededException: <p>The specified limit has been exceeded. Review your request and retry it with a quantity below the stated limit.</p>
        capo_translate.errors.too_many_requests_exception.TooManyRequestsException: <p> You have made too many requests within a short period of time. Wait for a short time and then try your request again.</p>
        capo_translate.errors.too_many_tags_exception.TooManyTagsException: <p>You have added too many tags to this resource. The maximum is 50 tags.</p>
        capo_translate.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_translate.types.import_terminology_request.ImportTerminologyRequest]",
    ) -> OperationResponse[
        "capo_translate.types.import_terminology_response.ImportTerminologyResponse"
    ]:
        import capo_translate._operations.aws_shine_frontend_service_20170701.import_terminology

        output, http_response = (
            capo_translate._operations.aws_shine_frontend_service_20170701.import_terminology.import_terminology(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_translate.types.import_terminology_request.ImportTerminologyRequest",
    ) -> dict[str, Any]:
        import capo_translate.types.import_terminology_request

        return capo_translate.types.import_terminology_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("ImportTerminology", redact_input=_redact_input),
    )
    input_: capo_translate.types.import_terminology_request.ImportTerminologyRequest = {
        "name": name,
        "merge_strategy": merge_strategy,
        "terminology_data": terminology_data,
    }
    if description is not None:
        input_["description"] = description
    if encryption_key is not None:
        input_["encryption_key"] = encryption_key
    if tags is not None:
        input_["tags"] = tags

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output