Skip to content

tag_resource

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

Use to assign one or more tags to a resource.

Parameters:

  • resource_arn (ProfilingGroupArn) –

    The Amazon Resource Name (ARN) of the resource that the tags are added to.

  • tags (TagsMap) –

    The list of tags that are added to the specified resource.

Raises:

Source code in docs_src/capo_codeguruprofiler/_services/code_guru_profiler.py
def tag_resource(
    self,
    resource_arn: "capo_codeguruprofiler.types.profiling_group_arn.ProfilingGroupArn",
    tags: "capo_codeguruprofiler.types.tags_map.TagsMap",
    *,
    config_overrides: Optional[CodeGuruProfilerClientConfig] = None,
) -> "capo_codeguruprofiler.types.tag_resource_response.TagResourceResponse":
    """<p> Use to assign one or more tags to a resource. </p>

    Args:
        resource_arn: <p> The Amazon Resource Name (ARN) of the resource that the tags are added to. </p>
        tags: <p> The list of tags that are added to the specified resource. </p>

    Raises:
        capo_codeguruprofiler.errors.internal_server_exception.InternalServerException: <p>The server encountered an internal error and is unable to complete the request.</p>
        capo_codeguruprofiler.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource specified in the request does not exist.</p>
        capo_codeguruprofiler.errors.validation_exception.ValidationException: <p>The parameter is not valid.</p>
        capo_codeguruprofiler.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

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

        output, http_response = (
            capo_codeguruprofiler._operations.code_guru_profiler.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_codeguruprofiler.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