Skip to content

tag_resource async

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

Adds the specified tags to the specified resource. If a tag key already exists, the existing value is replaced with the new value.

Parameters:

  • resource_arn (AmazonResourceName) –

    The Amazon Resource Name (ARN) of the bot, bot alias, or bot channel to tag.

  • tags (TagList) –

    A list of tag keys to add to the resource. If a tag key already exists, the existing value is replaced with the new value.

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.

  • 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 tag_resource(
    self,
    resource_arn: "capo_lex_model_building_service.types.amazon_resource_name.AmazonResourceName",
    tags: "capo_lex_model_building_service.types.tag_list.TagList",
    *,
    config_overrides: Optional[AsyncLexModelBuildingServiceClientConfig] = None,
) -> "capo_lex_model_building_service.types.tag_resource_response.TagResourceResponse":
    """<p>Adds the specified tags to the specified resource. If a tag key already exists, the existing value is replaced with the new value.</p>

    Args:
        resource_arn: <p>The Amazon Resource Name (ARN) of the bot, bot alias, or bot channel to tag.</p>
        tags: <p>A list of tag keys to add to the resource. If a tag key already exists, the existing value is replaced with the new value.</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.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_lex_model_building_service.types.tag_resource_request.TagResourceRequest]",
    ) -> AsyncOperationResponse[
        "capo_lex_model_building_service.types.tag_resource_response.TagResourceResponse"
    ]:
        import capo_lex_model_building_service._operations.aws_deep_sense_model_building_service.tag_resource

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

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

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