Skip to content

tag_resource

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

Adds a tag to a resource.

Parameters:

  • resource_arn (Arn) –

    The Amazon Resource Name (ARN) of the resource.

  • tags (TagMap) –

    The tags for a resource.

Raises:

Source code in docs_src/capo_networkflowmonitor/_services/network_flow_monitor.py
def tag_resource(
    self,
    resource_arn: "capo_networkflowmonitor.types.arn.Arn",
    tags: "capo_networkflowmonitor.types.tag_map.TagMap",
    *,
    config_overrides: Optional[NetworkFlowMonitorClientConfig] = None,
) -> "capo_networkflowmonitor.types.tag_resource_output.TagResourceOutput":
    """<p>Adds a tag to a resource.</p>

    Args:
        resource_arn: <p>The Amazon Resource Name (ARN) of the resource.</p>
        tags: <p>The tags for a resource.</p>

    Raises:
        capo_networkflowmonitor.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient permission to perform this action.</p>
        capo_networkflowmonitor.errors.conflict_exception.ConflictException: <p>The requested resource is in use.</p>
        capo_networkflowmonitor.errors.internal_server_exception.InternalServerException: <p>An internal error occurred.</p>
        capo_networkflowmonitor.errors.resource_not_found_exception.ResourceNotFoundException: <p>The request specifies a resource that doesn't exist.</p>
        capo_networkflowmonitor.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_networkflowmonitor.errors.validation_exception.ValidationException: <p>Invalid request.</p>
        capo_networkflowmonitor.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

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

        output, http_response = (
            capo_networkflowmonitor._operations.network_flow_monitor.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_networkflowmonitor.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