View a markdown version of this page

标记 HealthLake 数据存储 - AWS HealthLake

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

标记 HealthLake 数据存储

您可以以标签的形式将元 HealthLake 数据分配给数据存储。每个标签都是由用户定义的键和值组成的标签。标签可帮助您管理、识别、组织、搜索和筛选数据存储。

重要提示

请勿在标签中存储受保护的健康信息(PHI)、个人身份信息(PII)或其他机密或敏感信息。标签的用途并非用于私人或敏感数据。

以下主题介绍如何使用 AWS 管理控制台 AWS CLI、和 AWS SDKs使用 HealthLake 标记操作。有关更多信息,请参阅AWS 一般参考 指南中的为AWS 资源添加标签。

标记 HealthLake 数据存储

TagResource用于标记 HealthLake 数据存储。以下菜单提供了操作步骤 AWS 管理控制台 和 AWS CLI 和的代码示例 AWS SDKs。有关更多信息,请参阅《AWS HealthLake API Reference》中的 TagResource。

为 HealthLake 数据存储添加标签

根据您的访问偏好选择菜单 AWS HealthLake。

CLI
AWS CLI

向数据存储中添加标签

以下 tag-resource 示例演示如何向数据存储中添加标签。

aws healthlake tag-resource \ --resource-arn "arn:aws:healthlake:us-east-1:123456789012:datastore/fhir/0725c83f4307f263e16fd56b6d8ebdbe" \ --tags '[{"Key": "key1", "Value": "value1"}]'

此命令不生成任何输出。

。

  • 有关 API 的详细信息,请参阅AWS CLI 命令参考TagResource中的。

Python
适用于 Python 的 SDK(Boto3)
@classmethod def from_client(cls) -> "HealthLakeWrapper": """ Creates a HealthLakeWrapper instance with a default AWS HealthLake client. :return: An instance of HealthLakeWrapper initialized with the default HealthLake client. """ health_lake_client = boto3.client("healthlake") return cls(health_lake_client) def tag_resource(self, resource_arn: str, tags: list[dict[str, str]]) -> None: """ Tags a HealthLake resource. :param resource_arn: The resource ARN. :param tags: The tags to add to the resource. """ try: self.health_lake_client.tag_resource(ResourceARN=resource_arn, Tags=tags) except ClientError as err: logger.exception( "Couldn't tag resource %s. Here's why %s", resource_arn, err.response["Error"]["Message"], ) raise
  • 有关 API 的详细信息,请参阅适用TagResource于 Python 的AWS SDK (Boto3) API 参考。

注意

还有更多相关信息 GitHub。在 AWS 代码示例存储库中查找完整示例,了解如何进行设置和运行。

SAP ABAP
适用于 SAP ABAP 的 SDK
注意

还有更多相关信息 GitHub。在 AWS 代码示例存储库中查找完整示例,了解如何进行设置和运行。

TRY. " iv_resource_arn = 'arn:aws:healthlake:us-east-1:123456789012:datastore/fhir/a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6' lo_hll->tagresource( iv_resourcearn = iv_resource_arn it_tags = it_tags ). MESSAGE 'Resource tagged successfully.' TYPE 'I'. CATCH /aws1/cx_hllvalidationex INTO DATA(lo_validation_ex). DATA(lv_error) = |Validation error: { lo_validation_ex->av_err_code }-{ lo_validation_ex->av_err_msg }|. MESSAGE lv_error TYPE 'I'. RAISE EXCEPTION lo_validation_ex. CATCH /aws1/cx_hllresourcenotfoundex INTO DATA(lo_notfound_ex). lv_error = |Resource not found: { lo_notfound_ex->av_err_code }-{ lo_notfound_ex->av_err_msg }|. MESSAGE lv_error TYPE 'I'. RAISE EXCEPTION lo_notfound_ex. ENDTRY.
  • 有关 API 的详细信息,请参阅适用TagResource于 S AP 的AWS SDK ABAP API 参考。

示例可用性

找不到所需的内容? 使用本页右侧边栏上的 “提供反馈” 链接请求代码示例。

  1. 登录 HealthLake 控制台上的数据存储页面。

  2. 选择数据存储。

    数据存储详细信息页面将会打开。

  3. 在 标签 部分中,选择 管理标签。

    将打开管理标签页面。

  4. 选择 添加新标签。

  5. 输入一个 键和可选的 值(可选)。

  6. 选择保存。

列出 HealthLake 数据存储的标签

ListTagsForResource用于列出 HealthLake 数据存储的标签。以下菜单提供了操作步骤 AWS 管理控制台 和 AWS CLI 和的代码示例 AWS SDKs。有关更多信息,请参阅《AWS HealthLake API Reference》中的 ListTagsForResource。

列出 HealthLake 数据存储的标签

根据您的访问偏好选择菜单 AWS HealthLake。

CLI
AWS CLI

列出数据存储的标签

以下 list-tags-for-resource 示例列出与指定数据存储关联的标签。

aws healthlake list-tags-for-resource \ --resource-arn "arn:aws:healthlake:us-east-1:123456789012:datastore/fhir/0725c83f4307f263e16fd56b6d8ebdbe"

输出:

{ "tags": { "key": "value", "key1": "value1" } }

Python
适用于 Python 的 SDK(Boto3)
@classmethod def from_client(cls) -> "HealthLakeWrapper": """ Creates a HealthLakeWrapper instance with a default AWS HealthLake client. :return: An instance of HealthLakeWrapper initialized with the default HealthLake client. """ health_lake_client = boto3.client("healthlake") return cls(health_lake_client) def list_tags_for_resource(self, resource_arn: str) -> dict[str, str]: """ Lists the tags for a HealthLake resource. :param resource_arn: The resource ARN. :return: The tags for the resource. """ try: response = self.health_lake_client.list_tags_for_resource( ResourceARN=resource_arn ) return response["Tags"] except ClientError as err: logger.exception( "Couldn't list tags for resource %s. Here's why %s", resource_arn, err.response["Error"]["Message"], ) raise
  • 有关 API 的详细信息,请参阅适用ListTagsForResource于 Python 的AWS SDK (Boto3) API 参考。

注意

还有更多相关信息 GitHub。在 AWS 代码示例存储库中查找完整示例,了解如何进行设置和运行。

SAP ABAP
适用于 SAP ABAP 的 SDK
注意

还有更多相关信息 GitHub。在 AWS 代码示例存储库中查找完整示例,了解如何进行设置和运行。

TRY. " iv_resource_arn = 'arn:aws:healthlake:us-east-1:123456789012:datastore/fhir/a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6' DATA(lo_result) = lo_hll->listtagsforresource( iv_resourcearn = iv_resource_arn ). ot_tags = lo_result->get_tags( ). DATA(lv_tag_count) = lines( ot_tags ). MESSAGE |Found { lv_tag_count } tag(s).| TYPE 'I'. CATCH /aws1/cx_hllvalidationex INTO DATA(lo_validation_ex). DATA(lv_error) = |Validation error: { lo_validation_ex->av_err_code }-{ lo_validation_ex->av_err_msg }|. MESSAGE lv_error TYPE 'I'. RAISE EXCEPTION lo_validation_ex. CATCH /aws1/cx_hllresourcenotfoundex INTO DATA(lo_notfound_ex). lv_error = |Resource not found: { lo_notfound_ex->av_err_code }-{ lo_notfound_ex->av_err_msg }|. MESSAGE lv_error TYPE 'I'. RAISE EXCEPTION lo_notfound_ex. ENDTRY.
  • 有关 API 的详细信息,请参阅适用ListTagsForResource于 S AP 的AWS SDK ABAP API 参考。

示例可用性

找不到所需的内容? 使用本页右侧边栏上的 “提供反馈” 链接请求代码示例。

  1. 登录 HealthLake 控制台上的数据存储页面。

  2. 选择数据存储。

    数据存储详细信息页面将会打开。在标签部分下,列出了所有数据存储标签。

取消标记数据存储 HealthLake

UntagResource用于从 HealthLake 数据存储中移除标签。以下菜单提供了操作步骤 AWS 管理控制台 和 AWS CLI 和的代码示例 AWS SDKs。有关更多信息,请参阅《AWS HealthLake API Reference》中的 UntagResource。

取消对 HealthLake 数据存储的标记

根据您的访问偏好选择菜单 AWS HealthLake。

CLI
AWS CLI

从数据存储中移除标签

以下 untag-resource 示例演示如何从数据存储中移除标签。

aws healthlake untag-resource \ --resource-arn "arn:aws:healthlake:us-east-1:123456789012:datastore/fhir/b91723d65c6fdeb1d26543a49d2ed1fa" \ --tag-keys '["key1"]'

此命令不生成任何输出。

  • 有关 API 的详细信息,请参阅AWS CLI 命令参考UntagResource中的。

Python
适用于 Python 的 SDK(Boto3)
@classmethod def from_client(cls) -> "HealthLakeWrapper": """ Creates a HealthLakeWrapper instance with a default AWS HealthLake client. :return: An instance of HealthLakeWrapper initialized with the default HealthLake client. """ health_lake_client = boto3.client("healthlake") return cls(health_lake_client) def untag_resource(self, resource_arn: str, tag_keys: list[str]) -> None: """ Untags a HealthLake resource. :param resource_arn: The resource ARN. :param tag_keys: The tag keys to remove from the resource. """ try: self.health_lake_client.untag_resource( ResourceARN=resource_arn, TagKeys=tag_keys ) except ClientError as err: logger.exception( "Couldn't untag resource %s. Here's why %s", resource_arn, err.response["Error"]["Message"], ) raise
  • 有关 API 的详细信息,请参阅适用UntagResource于 Python 的AWS SDK (Boto3) API 参考。

注意

还有更多相关信息 GitHub。在 AWS 代码示例存储库中查找完整示例,了解如何进行设置和运行。

SAP ABAP
适用于 SAP ABAP 的 SDK
注意

还有更多相关信息 GitHub。在 AWS 代码示例存储库中查找完整示例,了解如何进行设置和运行。

TRY. " iv_resource_arn = 'arn:aws:healthlake:us-east-1:123456789012:datastore/fhir/a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6' lo_hll->untagresource( iv_resourcearn = iv_resource_arn it_tagkeys = it_tag_keys ). MESSAGE 'Resource untagged successfully.' TYPE 'I'. CATCH /aws1/cx_hllvalidationex INTO DATA(lo_validation_ex). DATA(lv_error) = |Validation error: { lo_validation_ex->av_err_code }-{ lo_validation_ex->av_err_msg }|. MESSAGE lv_error TYPE 'I'. RAISE EXCEPTION lo_validation_ex. CATCH /aws1/cx_hllresourcenotfoundex INTO DATA(lo_notfound_ex). lv_error = |Resource not found: { lo_notfound_ex->av_err_code }-{ lo_notfound_ex->av_err_msg }|. MESSAGE lv_error TYPE 'I'. RAISE EXCEPTION lo_notfound_ex. ENDTRY.
  • 有关 API 的详细信息,请参阅适用UntagResource于 S AP 的AWS SDK ABAP API 参考。

示例可用性

找不到所需的内容? 使用本页右侧边栏上的 “提供反馈” 链接请求代码示例。

  1. 登录 HealthLake 控制台上的数据存储页面。

  2. 选择数据存储。

    数据存储详细信息页面将会打开。

  3. 在 标签 部分中,选择 管理标签。

    将打开管理标签页面。

  4. 在标签旁选择 移除,以移除标签。

  5. 选择保存。