Skip to content

tag_resource async

tag_resource(
    resource_arn: Arn,
    tags: TagMap,
    *,
    config_overrides: Optional[AsyncControlTowerClientConfig] = None,
) -> TagResourceOutput

Applies tags to a resource. For usage examples, see the Controls Reference Guide .

Parameters:

  • resource_arn (Arn) –

    The ARN of the resource to be tagged.

  • tags (TagMap) –

    Tags to be applied to the resource.

Raises:

Source code in docs_src/capo_controltower/_services/async_control_tower.py
async def tag_resource(
    self,
    resource_arn: "capo_controltower.types.arn.Arn",
    tags: "capo_controltower.types.tag_map.TagMap",
    *,
    config_overrides: Optional[AsyncControlTowerClientConfig] = None,
) -> "capo_controltower.types.tag_resource_output.TagResourceOutput":
    """<p>Applies tags to a resource. For usage examples, see the <a href="https://docs.aws.amazon.com/controltower/latest/controlreference/control-api-examples-short.html"> <i>Controls Reference Guide</i> </a>.</p>

    Args:
        resource_arn: <p>The ARN of the resource to be tagged.</p>
        tags: <p>Tags to be applied to the resource.</p>

    Raises:
        capo_controltower.errors.internal_server_exception.InternalServerException: <p>An unexpected error occurred during processing of a request.</p>
        capo_controltower.errors.resource_not_found_exception.ResourceNotFoundException: <p>The request references a resource that does not exist.</p>
        capo_controltower.errors.validation_exception.ValidationException: <p>The input does not satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_controltower.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_controltower.types.tag_resource_input.TagResourceInput]",
    ) -> AsyncOperationResponse[
        "capo_controltower.types.tag_resource_output.TagResourceOutput"
    ]:
        import capo_controltower._operations.aws_control_tower_apis.tag_resource

        (
            output,
            http_response,
        ) = await capo_controltower._operations.aws_control_tower_apis.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_controltower.types.tag_resource_input.TagResourceInput = {
        "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