Skip to content

tag_resource

tag_resource(
    resource_arn: str,
    tags: TagsMap,
    *,
    config_overrides: Optional[AccessAnalyzerClientConfig] = None,
) -> TagResourceResponse

Adds a tag to the specified resource.

Parameters:

  • resource_arn (str) –

    The ARN of the resource to add the tag to.

  • tags (TagsMap) –

    The tags to add to the resource.

Raises:

Source code in docs_src/capo_accessanalyzer/_services/access_analyzer.py
def tag_resource(
    self,
    resource_arn: str,
    tags: "capo_accessanalyzer.types.tags_map.TagsMap",
    *,
    config_overrides: Optional[AccessAnalyzerClientConfig] = None,
) -> "capo_accessanalyzer.types.tag_resource_response.TagResourceResponse":
    """<p>Adds a tag to the specified resource.</p>

    Args:
        resource_arn: <p>The ARN of the resource to add the tag to.</p>
        tags: <p>The tags to add to the resource.</p>

    Raises:
        capo_accessanalyzer.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_accessanalyzer.errors.internal_server_exception.InternalServerException: <p>Internal server error.</p>
        capo_accessanalyzer.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource could not be found.</p>
        capo_accessanalyzer.errors.throttling_exception.ThrottlingException: <p>Throttling limit exceeded error.</p>
        capo_accessanalyzer.errors.validation_exception.ValidationException: <p>Validation exception error.</p>
        capo_accessanalyzer.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

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

        output, http_response = (
            capo_accessanalyzer._operations.access_analyzer.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_accessanalyzer.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