Skip to content

update_vocabulary_filter async

update_vocabulary_filter(
    vocabulary_filter_name: VocabularyFilterName,
    *,
    config_overrides: Optional[AsyncTranscribeClientConfig] = None,
    words: Optional[Words] = None,
    vocabulary_filter_file_uri: Optional[Uri] = None,
    data_access_role_arn: Optional[DataAccessRoleArn] = None,
    encryption_configuration: Optional[EncryptionConfiguration] = None,
) -> UpdateVocabularyFilterResponse

Updates an existing custom vocabulary filter with a new list of words. The new list you provide overwrites all previous entries; you cannot append new terms onto an existing custom vocabulary filter.

You must include either Words or VocabularyFilterFileUri in your request.

Parameters:

  • vocabulary_filter_name (VocabularyFilterName) –

    The name of the custom vocabulary filter you want to update. Custom vocabulary filter names are case sensitive.

  • words (Optional[Words], default: None ) –

    Use this parameter if you want to update your custom vocabulary filter by including all desired terms, as comma-separated values, within your request. The other option for updating your vocabulary filter is to save your entries in a text file and upload them to an Amazon S3 bucket, then specify the location of your file using the VocabularyFilterFileUri parameter.

    Note that if you include Words in your request, you cannot use VocabularyFilterFileUri; you must choose one or the other.

    Each language has a character set that contains all allowed characters for that specific language. If you use unsupported characters, your custom vocabulary filter request fails. Refer to Character Sets for Custom Vocabularies to get the character set for your language.

  • vocabulary_filter_file_uri (Optional[Uri], default: None ) –

    The Amazon S3 location of the text file that contains your custom vocabulary filter terms. The URI must be located in the same Amazon Web Services Region as the resource you're calling.

    Here's an example URI path: s3://DOC-EXAMPLE-BUCKET/my-vocab-filter-file.txt

    Note that if you include VocabularyFilterFileUri in your request, you cannot use Words; you must choose one or the other.

  • data_access_role_arn (Optional[DataAccessRoleArn], default: None ) –

    The Amazon Resource Name (ARN) of an IAM role that has permissions to access the Amazon S3 bucket that contains your input files (in this case, your custom vocabulary filter). If you include EncryptionConfiguration in your request, this role must also have permissions to access the specified KMS key. If the role that you specify doesn’t have the appropriate permissions, your request fails.

    IAM role ARNs have the format arn:partition:iam::account:role/role-name-with-path. For example: arn:aws:iam::111122223333:role/Admin.

    For more information, see IAM ARNs.

  • encryption_configuration (Optional[EncryptionConfiguration], default: None ) –

    Specifies the new encryption configuration for your custom vocabulary filter. The vocabulary filter artifacts are re-encrypted in place using the specified KMS key or with an AWS-owned key if a key is not supplied.

Raises:

  • BadRequestException –

    Your request didn't pass one or more validation tests. This can occur when the entity you're trying to delete doesn't exist or if it's in a non-terminal state (such as IN PROGRESS). See the exception message field for more information.

  • ConflictException –

    A resource already exists with this name. Resource names must be unique within an Amazon Web Services account.

  • InternalFailureException –

    There was an internal error. Check the error message, correct the issue, and try your request again.

  • LimitExceededException –

    You've either sent too many requests or your input file is too long. Wait before retrying your request, or use a smaller file and try your request again.

  • NotFoundException –

    We can't find the requested resource. Check that the specified name is correct and try your request again.

  • UnknownServiceError –

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

Source code in docs_src/capo_transcribe/_services/async_transcribe.py
async def update_vocabulary_filter(
    self,
    vocabulary_filter_name: "capo_transcribe.types.vocabulary_filter_name.VocabularyFilterName",
    *,
    config_overrides: Optional[AsyncTranscribeClientConfig] = None,
    words: Optional["capo_transcribe.types.words.Words"] = None,
    vocabulary_filter_file_uri: Optional["capo_transcribe.types.uri.Uri"] = None,
    data_access_role_arn: Optional[
        "capo_transcribe.types.data_access_role_arn.DataAccessRoleArn"
    ] = None,
    encryption_configuration: Optional[
        "capo_transcribe.types.encryption_configuration.EncryptionConfiguration"
    ] = None,
) -> "capo_transcribe.types.update_vocabulary_filter_response.UpdateVocabularyFilterResponse":
    """<p>Updates an existing custom vocabulary filter with a new list of words. The new list you provide overwrites all previous entries; you cannot append new terms onto an existing custom vocabulary filter.</p> <p>You must include either <code>Words</code> or <code>VocabularyFilterFileUri</code> in your request.</p>

    Args:
        vocabulary_filter_name: <p>The name of the custom vocabulary filter you want to update. Custom vocabulary filter names are case sensitive.</p>
        words: <p>Use this parameter if you want to update your custom vocabulary filter by including all desired terms, as comma-separated values, within your request. The other option for updating your vocabulary filter is to save your entries in a text file and upload them to an Amazon S3 bucket, then specify the location of your file using the <code>VocabularyFilterFileUri</code> parameter.</p> <p>Note that if you include <code>Words</code> in your request, you cannot use <code>VocabularyFilterFileUri</code>; you must choose one or the other.</p> <p>Each language has a character set that contains all allowed characters for that specific language. If you use unsupported characters, your custom vocabulary filter request fails. Refer to <a href="https://docs.aws.amazon.com/transcribe/latest/dg/charsets.html">Character Sets for Custom Vocabularies</a> to get the character set for your language.</p>
        vocabulary_filter_file_uri: <p>The Amazon S3 location of the text file that contains your custom vocabulary filter terms. The URI must be located in the same Amazon Web Services Region as the resource you're calling.</p> <p>Here's an example URI path: <code>s3://DOC-EXAMPLE-BUCKET/my-vocab-filter-file.txt</code> </p> <p>Note that if you include <code>VocabularyFilterFileUri</code> in your request, you cannot use <code>Words</code>; you must choose one or the other.</p>
        data_access_role_arn: <p>The Amazon Resource Name (ARN) of an IAM role that has permissions to access the Amazon S3 bucket that contains your input files (in this case, your custom vocabulary filter). If you include <code>EncryptionConfiguration</code> in your request, this role must also have permissions to access the specified KMS key. If the role that you specify doesn’t have the appropriate permissions, your request fails.</p> <p>IAM role ARNs have the format <code>arn:partition:iam::account:role/role-name-with-path</code>. For example: <code>arn:aws:iam::111122223333:role/Admin</code>.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html#identifiers-arns">IAM ARNs</a>.</p>
        encryption_configuration: <p>Specifies the new encryption configuration for your custom vocabulary filter. The vocabulary filter artifacts are re-encrypted in place using the specified KMS key or with an AWS-owned key if a key is not supplied.</p>

    Raises:
        capo_transcribe.errors.bad_request_exception.BadRequestException: <p>Your request didn't pass one or more validation tests. This can occur when the entity you're trying to delete doesn't exist or if it's in a non-terminal state (such as <code>IN PROGRESS</code>). See the exception message field for more information.</p>
        capo_transcribe.errors.conflict_exception.ConflictException: <p>A resource already exists with this name. Resource names must be unique within an Amazon Web Services account.</p>
        capo_transcribe.errors.internal_failure_exception.InternalFailureException: <p>There was an internal error. Check the error message, correct the issue, and try your request again.</p>
        capo_transcribe.errors.limit_exceeded_exception.LimitExceededException: <p>You've either sent too many requests or your input file is too long. Wait before retrying your request, or use a smaller file and try your request again.</p>
        capo_transcribe.errors.not_found_exception.NotFoundException: <p>We can't find the requested resource. Check that the specified name is correct and try your request again.</p>
        capo_transcribe.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_transcribe.types.update_vocabulary_filter_request.UpdateVocabularyFilterRequest]",
    ) -> AsyncOperationResponse[
        "capo_transcribe.types.update_vocabulary_filter_response.UpdateVocabularyFilterResponse"
    ]:
        import capo_transcribe._operations.transcribe.update_vocabulary_filter

        (
            output,
            http_response,
        ) = await capo_transcribe._operations.transcribe.update_vocabulary_filter.async_update_vocabulary_filter(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateVocabularyFilter")
    )
    input_: capo_transcribe.types.update_vocabulary_filter_request.UpdateVocabularyFilterRequest = {
        "vocabulary_filter_name": vocabulary_filter_name
    }
    if words is not None:
        input_["words"] = words
    if vocabulary_filter_file_uri is not None:
        input_["vocabulary_filter_file_uri"] = vocabulary_filter_file_uri
    if data_access_role_arn is not None:
        input_["data_access_role_arn"] = data_access_role_arn
    if encryption_configuration is not None:
        input_["encryption_configuration"] = encryption_configuration

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