Skip to content

tag_resource

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

Adds the specified tags to the specified space.

Parameters:

  • resource_arn (SpaceArn) –

    The Amazon Resource Name (ARN) of the space.

  • tags (TagList) –

    The tags to add to the space.

Raises:

  • AccessDeniedException –

    You don't have sufficient access to perform this operation. To use this operation, you must have AWS Identity and Access Management (IAM) permissions for the operation, and on the resource it acts on. If the space uses a customer managed AWS Key Management Service (AWS KMS) key, you must also have permission to use the key.

  • InternalServerException –

    The service couldn't process the request because of an internal error. Retry the request.

  • ResourceNotFoundException –

    The specified resource doesn't exist. Check the IDs in the request.

  • ThrottlingException –

    The service throttled the request. Retry the request with exponential backoff.

  • ValidationException –

    The request isn't valid. The reason, message, and fieldList members describe the problem. Fix the request, and then try again.

  • UnknownServiceError –

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

Source code in docs_src/capo_opensearchmemory/_services/open_search_memory.py
def tag_resource(
    self,
    resource_arn: "capo_opensearchmemory.types.space_arn.SpaceArn",
    tags: "capo_opensearchmemory.types.tag_list.TagList",
    *,
    config_overrides: Optional[OpenSearchMemoryClientConfig] = None,
) -> "capo_opensearchmemory.types.tag_resource_response.TagResourceResponse":
    """<p>Adds the specified tags to the specified space.</p>

    Args:
        resource_arn: <p>The Amazon Resource Name (ARN) of the space.</p>
        tags: <p>The tags to add to the space.</p>

    Raises:
        capo_opensearchmemory.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient access to perform this operation. To use this operation, you must have AWS Identity and Access Management (IAM) permissions for the operation, and on the resource it acts on. If the space uses a customer managed AWS Key Management Service (AWS KMS) key, you must also have permission to use the key.</p>
        capo_opensearchmemory.errors.internal_server_exception.InternalServerException: <p>The service couldn't process the request because of an internal error. Retry the request.</p>
        capo_opensearchmemory.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource doesn't exist. Check the IDs in the request.</p>
        capo_opensearchmemory.errors.throttling_exception.ThrottlingException: <p>The service throttled the request. Retry the request with exponential backoff.</p>
        capo_opensearchmemory.errors.validation_exception.ValidationException: <p>The request isn't valid. The <code>reason</code>, <code>message</code>, and <code>fieldList</code> members describe the problem. Fix the request, and then try again.</p>
        capo_opensearchmemory.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

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

        output, http_response = (
            capo_opensearchmemory._operations.open_search_memory.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_opensearchmemory.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