Skip to content

tag_resource

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

Adds the specified tags to the specified resource.

Parameters:

  • resource_arn (AmazonResourceName) –

    The Amazon Resource Name (ARN) of the resource.

  • tags (TagMap) –

    The tags for the resource.

Raises:

Examples:

To add tags to a proxy The following example adds the specified tags to the specified proxy.

>>> client.tag_resource(resource_arn='arn:aws:elasticloadbalancing:us-east-1:123456789012:proxy/my-proxy:0123456789abcdef', tags={'Environment': 'production', 'Team': 'networking'})
Source code in docs_src/capo_elb_proxy/_services/elb_proxy.py
def tag_resource(
    self,
    resource_arn: "capo_elb_proxy.types.amazon_resource_name.AmazonResourceName",
    tags: "capo_elb_proxy.types.tag_map.TagMap",
    *,
    config_overrides: Optional[ELBProxyClientConfig] = None,
) -> "capo_elb_proxy.types.tag_resource_output.TagResourceOutput":
    """Adds the specified tags to the specified resource.

    Args:
        resource_arn: The Amazon Resource Name (ARN) of the resource.
        tags: The tags for the resource.

    Raises:
        capo_elb_proxy.errors.internal_server_exception.InternalServerException: An unexpected error occurred while processing the request.
        capo_elb_proxy.errors.throttling_exception.ThrottlingException: The limit on the number of requests per second was exceeded.
        capo_elb_proxy.errors.access_denied_exception.AccessDeniedException: The user does not have sufficient access to perform this action.
        capo_elb_proxy.errors.resource_not_found_exception.ResourceNotFoundException: The request references a resource that does not exist.
        capo_elb_proxy.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: The request would cause a service quota to be exceeded.
        capo_elb_proxy.errors.validation_exception.ValidationException: The input does not satisfy the constraints specified by an AWS service.
        capo_elb_proxy.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To add tags to a proxy
        The following example adds the specified tags to the specified proxy.

        >>> client.tag_resource(resource_arn='arn:aws:elasticloadbalancing:us-east-1:123456789012:proxy/my-proxy:0123456789abcdef', tags={'Environment': 'production', 'Team': 'networking'})
    """

    def _handler(
        req: "OperationRequest[capo_elb_proxy.types.tag_resource_input.TagResourceInput]",
    ) -> OperationResponse[
        "capo_elb_proxy.types.tag_resource_output.TagResourceOutput"
    ]:
        import capo_elb_proxy._operations.elb_proxy.tag_resource

        output, http_response = (
            capo_elb_proxy._operations.elb_proxy.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_elb_proxy.types.tag_resource_input.TagResourceInput = {
        "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