Skip to content

tag_resource

tag_resource(
    resource_arn: TranscribeArn,
    tags: TagList,
    *,
    config_overrides: Optional[TranscribeClientConfig] = None,
) -> TagResourceResponse

Adds one or more custom tags, each in the form of a key:value pair, to the specified resource.

To learn more about using tags with Amazon Transcribe, refer to Tagging resources.

Parameters:

  • resource_arn (TranscribeArn) –

    The Amazon Resource Name (ARN) of the resource you want to tag. ARNs have the format arn:partition:service:region:account-id:resource-type/resource-id.

    For example, arn:aws:transcribe:us-west-2:111122223333:transcription-job/transcription-job-name.

    Valid values for resource-type are: transcription-job, medical-transcription-job, vocabulary, medical-vocabulary, vocabulary-filter, and language-model.

  • tags (TagList) –

    Adds one or more custom tags, each in the form of a key:value pair, to the specified resource.

    To learn more about using tags with Amazon Transcribe, refer to Tagging resources.

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/transcribe.py
def tag_resource(
    self,
    resource_arn: "capo_transcribe.types.transcribe_arn.TranscribeArn",
    tags: "capo_transcribe.types.tag_list.TagList",
    *,
    config_overrides: Optional[TranscribeClientConfig] = None,
) -> "capo_transcribe.types.tag_resource_response.TagResourceResponse":
    """<p>Adds one or more custom tags, each in the form of a key:value pair, to the specified resource.</p> <p>To learn more about using tags with Amazon Transcribe, refer to <a href="https://docs.aws.amazon.com/transcribe/latest/dg/tagging.html">Tagging resources</a>.</p>

    Args:
        resource_arn: <p>The Amazon Resource Name (ARN) of the resource you want to tag. ARNs have the format <code>arn:partition:service:region:account-id:resource-type/resource-id</code>.</p> <p>For example, <code>arn:aws:transcribe:us-west-2:111122223333:transcription-job/transcription-job-name</code>.</p> <p>Valid values for <code>resource-type</code> are: <code>transcription-job</code>, <code>medical-transcription-job</code>, <code>vocabulary</code>, <code>medical-vocabulary</code>, <code>vocabulary-filter</code>, and <code>language-model</code>.</p>
        tags: <p>Adds one or more custom tags, each in the form of a key:value pair, to the specified resource.</p> <p>To learn more about using tags with Amazon Transcribe, refer to <a href="https://docs.aws.amazon.com/transcribe/latest/dg/tagging.html">Tagging resources</a>.</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.
    """

    def _handler(
        req: "OperationRequest[capo_transcribe.types.tag_resource_request.TagResourceRequest]",
    ) -> OperationResponse[
        "capo_transcribe.types.tag_resource_response.TagResourceResponse"
    ]:
        import capo_transcribe._operations.transcribe.tag_resource

        output, http_response = (
            capo_transcribe._operations.transcribe.tag_resource.tag_resource(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("TagResource")
    )
    input_: capo_transcribe.types.tag_resource_request.TagResourceRequest = {
        "resource_arn": resource_arn,
        "tags": tags,
    }

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