Skip to content

tag_resource

tag_resource(
    resource_arn: ArnString,
    tags: InputTagMap,
    *,
    config_overrides: Optional[ManagedBlockchainClientConfig] = None,
) -> TagResourceResponse

Adds or overwrites the specified tags for the specified Amazon Managed Blockchain resource. Each tag consists of a key and optional value.

When you specify a tag key that already exists, the tag value is overwritten with the new value. Use UntagResource to remove tag keys.

A resource can have up to 50 tags. If you try to create more than 50 tags for a resource, your request fails and returns an error.

For more information about tags, see Tagging Resources in the Amazon Managed Blockchain Ethereum Developer Guide, or Tagging Resources in the Amazon Managed Blockchain Hyperledger Fabric Developer Guide.

Parameters:

  • resource_arn (ArnString) –

    The Amazon Resource Name (ARN) of the resource. For more information about ARNs and their format, see Amazon Resource Names (ARNs) in the Amazon Web Services General Reference.

  • tags (InputTagMap) –

    The tags to assign to the specified resource. Tag values can be empty, for example, "MyTagKey" : "". You can specify multiple key-value pairs in a single request, with an overall maximum of 50 tags added to each resource.

Raises:

Source code in docs_src/capo_managedblockchain/_services/managed_blockchain.py
def tag_resource(
    self,
    resource_arn: "capo_managedblockchain.types.arn_string.ArnString",
    tags: "capo_managedblockchain.types.input_tag_map.InputTagMap",
    *,
    config_overrides: Optional[ManagedBlockchainClientConfig] = None,
) -> "capo_managedblockchain.types.tag_resource_response.TagResourceResponse":
    """<p>Adds or overwrites the specified tags for the specified Amazon Managed Blockchain resource. Each tag consists of a key and optional value.</p> <p>When you specify a tag key that already exists, the tag value is overwritten with the new value. Use <code>UntagResource</code> to remove tag keys.</p> <p>A resource can have up to 50 tags. If you try to create more than 50 tags for a resource, your request fails and returns an error.</p> <p>For more information about tags, see <a href="https://docs.aws.amazon.com/managed-blockchain/latest/ethereum-dev/tagging-resources.html">Tagging Resources</a> in the <i>Amazon Managed Blockchain Ethereum Developer Guide</i>, or <a href="https://docs.aws.amazon.com/managed-blockchain/latest/hyperledger-fabric-dev/tagging-resources.html">Tagging Resources</a> in the <i>Amazon Managed Blockchain Hyperledger Fabric Developer Guide</i>.</p>

    Args:
        resource_arn: <p>The Amazon Resource Name (ARN) of the resource. For more information about ARNs and their format, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names (ARNs)</a> in the <i>Amazon Web Services General Reference</i>.</p>
        tags: <p>The tags to assign to the specified resource. Tag values can be empty, for example, <code>"MyTagKey" : ""</code>. You can specify multiple key-value pairs in a single request, with an overall maximum of 50 tags added to each resource.</p>

    Raises:
        capo_managedblockchain.errors.internal_service_error_exception.InternalServiceErrorException: <p>The request processing has failed because of an unknown error, exception or failure.</p>
        capo_managedblockchain.errors.invalid_request_exception.InvalidRequestException: <p>The action or operation requested is invalid. Verify that the action is typed correctly.</p>
        capo_managedblockchain.errors.resource_not_found_exception.ResourceNotFoundException: <p>A requested resource doesn't exist. It may have been deleted or referenced incorrectly.</p>
        capo_managedblockchain.errors.resource_not_ready_exception.ResourceNotReadyException: <p>The requested resource exists but isn't in a status that can complete the operation.</p>
        capo_managedblockchain.errors.too_many_tags_exception.TooManyTagsException: <p></p>
        capo_managedblockchain.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_managedblockchain.types.tag_resource_request.TagResourceRequest]",
    ) -> OperationResponse[
        "capo_managedblockchain.types.tag_resource_response.TagResourceResponse"
    ]:
        import capo_managedblockchain._operations.taiga_web_service.tag_resource

        output, http_response = (
            capo_managedblockchain._operations.taiga_web_service.tag_resource.tag_resource(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("TagResource")
    )
    input_: capo_managedblockchain.types.tag_resource_request.TagResourceRequest = {
        "resource_arn": resource_arn,
        "tags": tags,
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output