Skip to content

tag_resource async

tag_resource(
    resource_arn: str,
    tags: TagsMap,
    *,
    config_overrides: Optional[AsyncBraketClientConfig] = None,
) -> TagResourceResponse

Add a tag to the specified resource.

Parameters:

  • resource_arn (str) –

    Specify the resourceArn of the resource to which a tag will be added.

  • tags (TagsMap) –

    Specify the tags to add to the resource. Tags can be specified as a key-value map.

Raises:

Source code in docs_src/capo_braket/_services/async_braket.py
async def tag_resource(
    self,
    resource_arn: str,
    tags: "capo_braket.types.tags_map.TagsMap",
    *,
    config_overrides: Optional[AsyncBraketClientConfig] = None,
) -> "capo_braket.types.tag_resource_response.TagResourceResponse":
    """<p>Add a tag to the specified resource.</p>

    Args:
        resource_arn: <p>Specify the <code>resourceArn</code> of the resource to which a tag will be added.</p>
        tags: <p>Specify the tags to add to the resource. Tags can be specified as a key-value map.</p>

    Raises:
        capo_braket.errors.internal_service_exception.InternalServiceException: <p>The request failed because of an unknown error.</p>
        capo_braket.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found.</p>
        capo_braket.errors.validation_exception.ValidationException: <p>The input request failed to satisfy constraints expected by Amazon Braket.</p>
        capo_braket.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

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

        (
            output,
            http_response,
        ) = await capo_braket._operations.braket.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_braket.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