Skip to content

tag_resource

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

The TagResource operation associates tags with an Amazon Managed Grafana resource. Currently, the only resource that can be tagged is workspaces.

If you specify a new tag key for the resource, this tag is appended to the list of tags associated with the resource. If you specify a tag key that is already associated with the resource, the new tag value that you specify replaces the previous value for that tag.

Parameters:

  • resource_arn (str) –

    The ARN of the resource the tag is associated with.

  • tags (TagMap) –

    The list of tag keys and values to associate with the resource. You can associate tag keys only, tags (key and values) only or a combination of tag keys and tags.

Raises:

Source code in docs_src/capo_grafana/_services/grafana.py
def tag_resource(
    self,
    resource_arn: str,
    tags: "capo_grafana.types.tag_map.TagMap",
    *,
    config_overrides: Optional[grafanaClientConfig] = None,
) -> "capo_grafana.types.tag_resource_response.TagResourceResponse":
    """<p>The <code>TagResource</code> operation associates tags with an Amazon Managed Grafana resource. Currently, the only resource that can be tagged is workspaces. </p> <p>If you specify a new tag key for the resource, this tag is appended to the list of tags associated with the resource. If you specify a tag key that is already associated with the resource, the new tag value that you specify replaces the previous value for that tag.</p>

    Args:
        resource_arn: <p>The ARN of the resource the tag is associated with.</p>
        tags: <p>The list of tag keys and values to associate with the resource. You can associate tag keys only, tags (key and values) only or a combination of tag keys and tags.</p>

    Raises:
        capo_grafana.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient permissions to perform this action. </p>
        capo_grafana.errors.internal_server_exception.InternalServerException: <p>Unexpected error while processing the request. Retry the request.</p>
        capo_grafana.errors.resource_not_found_exception.ResourceNotFoundException: <p>The request references a resource that does not exist.</p>
        capo_grafana.errors.throttling_exception.ThrottlingException: <p>The request was denied because of request throttling. Retry the request.</p>
        capo_grafana.errors.validation_exception.ValidationException: <p>The value of a parameter in the request caused an error.</p>
        capo_grafana.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

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

        output, http_response = (
            capo_grafana._operations.aws_grafana_control_plane.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_grafana.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