Skip to content

tag_resource async

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

Assigns one or more tags (key-value pairs) to the specified resource.

Parameters:

  • resource_arn (TaggableResourceArn) –

    The Amazon Resource Name (ARN) of the resource that you want to tag.

  • tags (TagList) –

    A map of the key-value pairs of the tag or tags to assign.

Raises:

  • AccessDeniedException –

    This error occurs when you don't have permission to perform the requested action.

    You don’t have access to this action or resource. Review IAM policies or contact your AWS administrator for assistance.

  • ConflictException –

    This error occurs when the request can’t be processed due to a conflict with the target resource's current state, which could result from updating or deleting the resource.

    Suggested action: Fetch the latest state of the resource, verify the state, and retry the request.

  • InternalServerException –

    This error occurs when the specified resource can’t be found or doesn't exist. Resource ID and type might be incorrect.

    Suggested action: This is usually a transient error. Retry after the provided retry delay or a short interval. If the problem persists, contact AWS support.

  • ResourceNotFoundException –

    This error occurs when the specified resource can't be found. The resource might not exist, or isn't visible with the current credentials.

    Suggested action: Verify that the resource ID is correct and the resource is in the expected AWS region. Check IAM permissions for accessing the resource.

  • ThrottlingException –

    This error occurs when there are too many requests sent. Review the provided quotas and adapt your usage to avoid throttling.

    This error occurs when there are too many requests sent. Review the provided Quotas and retry after the provided delay.

  • ValidationException –

    The input fails to satisfy the constraints specified by the service or business validation rules.

    Suggested action: Review the error message, including the failed fields and reasons, to correct the request payload.

  • UnknownServiceError –

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

Source code in docs_src/capo_partnercentral_selling/_services/async_partner_central_selling.py
async def tag_resource(
    self,
    resource_arn: "capo_partnercentral_selling.types.taggable_resource_arn.TaggableResourceArn",
    tags: "capo_partnercentral_selling.types.tag_list.TagList",
    *,
    config_overrides: Optional[AsyncPartnerCentralSellingClientConfig] = None,
) -> "capo_partnercentral_selling.types.tag_resource_response.TagResourceResponse":
    """<p>Assigns one or more tags (key-value pairs) to the specified resource.</p>

    Args:
        resource_arn: <p>The Amazon Resource Name (ARN) of the resource that you want to tag.</p>
        tags: <p>A map of the key-value pairs of the tag or tags to assign.</p>

    Raises:
        capo_partnercentral_selling.errors.access_denied_exception.AccessDeniedException: <p>This error occurs when you don't have permission to perform the requested action.</p> <p>You don’t have access to this action or resource. Review IAM policies or contact your AWS administrator for assistance.</p>
        capo_partnercentral_selling.errors.conflict_exception.ConflictException: <p>This error occurs when the request can’t be processed due to a conflict with the target resource's current state, which could result from updating or deleting the resource.</p> <p>Suggested action: Fetch the latest state of the resource, verify the state, and retry the request.</p>
        capo_partnercentral_selling.errors.internal_server_exception.InternalServerException: <p>This error occurs when the specified resource can’t be found or doesn't exist. Resource ID and type might be incorrect.</p> <p>Suggested action: This is usually a transient error. Retry after the provided retry delay or a short interval. If the problem persists, contact AWS support.</p>
        capo_partnercentral_selling.errors.resource_not_found_exception.ResourceNotFoundException: <p>This error occurs when the specified resource can't be found. The resource might not exist, or isn't visible with the current credentials.</p> <p>Suggested action: Verify that the resource ID is correct and the resource is in the expected AWS region. Check IAM permissions for accessing the resource.</p>
        capo_partnercentral_selling.errors.throttling_exception.ThrottlingException: <p>This error occurs when there are too many requests sent. Review the provided quotas and adapt your usage to avoid throttling.</p> <p>This error occurs when there are too many requests sent. Review the provided <a href="https://docs.aws.amazon.com/partner-central/latest/selling-api/quotas.html">Quotas</a> and retry after the provided delay.</p>
        capo_partnercentral_selling.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by the service or business validation rules.</p> <p>Suggested action: Review the error message, including the failed fields and reasons, to correct the request payload.</p>
        capo_partnercentral_selling.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

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

        (
            output,
            http_response,
        ) = await capo_partnercentral_selling._operations.aws_partner_central_selling.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_selling.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