Skip to content

tag_resource async

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

Adds or replaces tags on an event bus, subscriber, or event source.

Parameters:

  • resource_arn (TaggableResourceArn) –

    ARN for an EventBridge resource that supports tagging: event buses, subscribers, and event sources.

  • tags (TagMap) –

    Tags attached to a resource, as key-value pairs.

Raises:

  • AccessDeniedException –

    The caller does not have the permissions required to perform the operation. This error is also returned when the operation cannot use the AWS KMS key for the event bus.

  • InternalException –

    The request failed because of an internal service error. Retry the request.

  • InvalidInputException –

    A request parameter is missing or not valid.

  • ThrottlingException –

    The request was throttled because it exceeds a request rate limit. Retry the request with backoff.

  • ConcurrentModificationException –

    Another change to the resource is already in progress. Retry the request.

  • InvalidStateException –

    The resource is not in a state that allows the operation. For example, an event bus that is still being created cannot accept events.

  • LimitExceededException –

    The request would exceed a service quota for the account.

  • ResourceNotFoundException –

    The resource does not exist.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_eventbridgev2/_services/async_event_bridge_v2.py
async def tag_resource(
    self,
    resource_arn: "capo_eventbridgev2.types.taggable_resource_arn.TaggableResourceArn",
    tags: "capo_eventbridgev2.types.tag_map.TagMap",
    *,
    config_overrides: Optional[AsyncEventBridgeV2ClientConfig] = None,
) -> "capo_eventbridgev2.types.tag_resource_response.TagResourceResponse":
    """<p>Adds or replaces tags on an event bus, subscriber, or event source.</p>

    Args:
        resource_arn: <p>ARN for an EventBridge resource that supports tagging: event buses, subscribers, and event sources.</p>
        tags: <p>Tags attached to a resource, as key-value pairs.</p>

    Raises:
        capo_eventbridgev2.errors.access_denied_exception.AccessDeniedException: <p>The caller does not have the permissions required to perform the operation. This error is also returned when the operation cannot use the AWS KMS key for the event bus.</p>
        capo_eventbridgev2.errors.internal_exception.InternalException: <p>The request failed because of an internal service error. Retry the request.</p>
        capo_eventbridgev2.errors.invalid_input_exception.InvalidInputException: <p>A request parameter is missing or not valid.</p>
        capo_eventbridgev2.errors.throttling_exception.ThrottlingException: <p>The request was throttled because it exceeds a request rate limit. Retry the request with backoff.</p>
        capo_eventbridgev2.errors.concurrent_modification_exception.ConcurrentModificationException: <p>Another change to the resource is already in progress. Retry the request.</p>
        capo_eventbridgev2.errors.invalid_state_exception.InvalidStateException: <p>The resource is not in a state that allows the operation. For example, an event bus that is still being created cannot accept events.</p>
        capo_eventbridgev2.errors.limit_exceeded_exception.LimitExceededException: <p>The request would exceed a service quota for the account.</p>
        capo_eventbridgev2.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource does not exist.</p>
        capo_eventbridgev2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_eventbridgev2.types.tag_resource_request.TagResourceRequest]",
    ) -> AsyncOperationResponse[
        "capo_eventbridgev2.types.tag_resource_response.TagResourceResponse"
    ]:
        import capo_eventbridgev2._operations.aws_events_v2.tag_resource

        (
            output,
            http_response,
        ) = await capo_eventbridgev2._operations.aws_events_v2.tag_resource.async_tag_resource(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("TagResource")
    )
    input_: capo_eventbridgev2.types.tag_resource_request.TagResourceRequest = {
        "resource_arn": resource_arn,
        "tags": tags,
    }

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output