Skip to content

tag_resource async

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

Adds tags to a profile or profile entry. A tag whose key the resource already has replaces that tag's value.

Parameters:

  • resource_arn (Arn) –

    The ARN of the profile or profile entry to tag.

  • tags (TagMap) –

    The tags to add or replace.

Raises:

  • AccessDeniedException –

    The caller does not have permission to perform the operation.

  • InternalServerException –

    The service couldn't process the request because of an internal error. Retry with capped exponential backoff and jitter.

  • ThrottlingException –

    The request rate exceeded a limit. Retry with capped exponential backoff and jitter.

  • ResourceNotFoundException –

    The specified resource does not exist or the caller does not have permission to access it.

  • ValidationException –

    The request was malformed or contained invalid parameter values.

  • UnknownServiceError –

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

Source code in docs_src/capo_cloudextensions/_services/async_cloud_extensions.py
async def tag_resource(
    self,
    resource_arn: "capo_cloudextensions.types.arn.Arn",
    tags: "capo_cloudextensions.types.tag_map.TagMap",
    *,
    config_overrides: Optional[AsyncCloudExtensionsClientConfig] = None,
) -> "capo_cloudextensions.types.tag_resource_output.TagResourceOutput":
    """Adds tags to a profile or profile entry. A tag whose key the resource already has replaces that tag's value.

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

    Raises:
        capo_cloudextensions.errors.access_denied_exception.AccessDeniedException: The caller does not have permission to perform the operation.
        capo_cloudextensions.errors.internal_server_exception.InternalServerException: The service couldn't process the request because of an internal error. Retry with capped exponential backoff and jitter.
        capo_cloudextensions.errors.throttling_exception.ThrottlingException: The request rate exceeded a limit. Retry with capped exponential backoff and jitter.
        capo_cloudextensions.errors.resource_not_found_exception.ResourceNotFoundException: The specified resource does not exist or the caller does not have permission to access it.
        capo_cloudextensions.errors.validation_exception.ValidationException: The request was malformed or contained invalid parameter values.
        capo_cloudextensions.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cloudextensions.types.tag_resource_input.TagResourceInput]",
    ) -> AsyncOperationResponse[
        "capo_cloudextensions.types.tag_resource_output.TagResourceOutput"
    ]:
        import capo_cloudextensions._operations.control_plane.tag_resource

        (
            output,
            http_response,
        ) = await capo_cloudextensions._operations.control_plane.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_cloudextensions.types.tag_resource_input.TagResourceInput = {
        "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