Skip to content

tag_resource async

tag_resource(
    resource_arn: TagrisArn,
    resource_tags: ResourceTagList,
    *,
    config_overrides: Optional[AsyncInvoicingClientConfig] = None,
) -> TagResourceResponse

Adds a tag to a resource.

Parameters:

  • resource_arn (TagrisArn) –

    The Amazon Resource Name (ARN) of the tags.

  • resource_tags (ResourceTagList) –

    Adds a tag to a resource.

Raises:

Examples:

TagResource

>>> await client.tag_resource(resource_arn='arn:aws:invoicing::000000000000:invoice-unit/12345678', resource_tags=[{'Key': 'TagKey', 'Value': 'TagValue'}])
Source code in docs_src/capo_invoicing/_services/async_invoicing.py
async def tag_resource(
    self,
    resource_arn: "capo_invoicing.types.tagris_arn.TagrisArn",
    resource_tags: "capo_invoicing.types.resource_tag_list.ResourceTagList",
    *,
    config_overrides: Optional[AsyncInvoicingClientConfig] = None,
) -> "capo_invoicing.types.tag_resource_response.TagResourceResponse":
    """<p>Adds a tag to a resource. </p>

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

    Raises:
        capo_invoicing.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient access to perform this action.</p>
        capo_invoicing.errors.internal_server_exception.InternalServerException: <p>The processing request failed because of an unknown error, exception, or failure. </p>
        capo_invoicing.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource could not be found. </p>
        capo_invoicing.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded. </p>
        capo_invoicing.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_invoicing.errors.validation_exception.ValidationException: <p> The input fails to satisfy the constraints specified by an Amazon Web Services service. </p>
        capo_invoicing.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        TagResource

        >>> await client.tag_resource(resource_arn='arn:aws:invoicing::000000000000:invoice-unit/12345678', resource_tags=[{'Key': 'TagKey', 'Value': 'TagValue'}])
    """

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

        (
            output,
            http_response,
        ) = await capo_invoicing._operations.invoicing.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_invoicing.types.tag_resource_request.TagResourceRequest = {
        "resource_arn": resource_arn,
        "resource_tags": resource_tags,
    }

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