Skip to content

tag_resource async

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

Adds or replaces tags on a Partner Central Marketing resource. Idempotent: applying a tag that is already present with the same value is a no-op, and supplying a key that already exists replaces its value.

Parameters:

Raises:

  • AccessDeniedException –

    You do not have sufficient access to perform this action. An IAM denial carries no Reason. A refusal for the caller's Partner Central state carries one, so a client tells the two apart by its presence.

  • InternalServerException –

    An unexpected error occurred during the processing of the request.

  • ThrottlingException –

    The request was denied due to request throttling.

  • ValidationException –

    The input fails to satisfy the constraints specified by the service. A caller branches on Reason, and where the rejection is attributable to particular fields it reads FieldList rather than parsing Message, which is prose and may change.

  • ConflictException –

    The request conflicts with the current state of the resource.

  • ResourceNotFoundException –

    The specified resource does not exist.

  • ServiceQuotaExceededException –

    The request exceeds a service quota.

  • UnknownServiceError –

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

Source code in docs_src/capo_partnercentral_marketing/_services/async_partner_central_marketing.py
async def tag_resource(
    self,
    resource_arn: "capo_partnercentral_marketing.types.taggable_resource_arn.TaggableResourceArn",
    tags: "capo_partnercentral_marketing.types.tag_list.TagList",
    *,
    config_overrides: Optional[AsyncPartnerCentralMarketingClientConfig] = None,
) -> (
    "capo_partnercentral_marketing.types.tag_resource_response.TagResourceResponse"
):
    """Adds or replaces tags on a Partner Central Marketing resource. Idempotent: applying a tag that is already present with the same value is a no-op, and supplying a key that already exists replaces its value.

    Args:
        resource_arn: The ARN of the resource to tag.
        tags: The tags to add or replace.

    Raises:
        capo_partnercentral_marketing.errors.access_denied_exception.AccessDeniedException: You do not have sufficient access to perform this action. An IAM denial carries no `Reason`. A refusal for the caller's Partner Central state carries one, so a client tells the two apart by its presence.
        capo_partnercentral_marketing.errors.internal_server_exception.InternalServerException: An unexpected error occurred during the processing of the request.
        capo_partnercentral_marketing.errors.throttling_exception.ThrottlingException: The request was denied due to request throttling.
        capo_partnercentral_marketing.errors.validation_exception.ValidationException: The input fails to satisfy the constraints specified by the service. A caller branches on `Reason`, and where the rejection is attributable to particular fields it reads `FieldList` rather than parsing `Message`, which is prose and may change.
        capo_partnercentral_marketing.errors.conflict_exception.ConflictException: The request conflicts with the current state of the resource.
        capo_partnercentral_marketing.errors.resource_not_found_exception.ResourceNotFoundException: The specified resource does not exist.
        capo_partnercentral_marketing.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: The request exceeds a service quota.
        capo_partnercentral_marketing.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

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

        (
            output,
            http_response,
        ) = await capo_partnercentral_marketing._operations.aws_partner_demand_generator.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_partnercentral_marketing.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