本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
标记 HealthLake 数据存储
您可以以标签的形式将元 HealthLake 数据分配给数据存储。每个标签都是由用户定义的键和值组成的标签。标签可帮助您管理、识别、组织、搜索和筛选数据存储。
请勿在标签中存储受保护的健康信息(PHI)、个人身份信息(PII)或其他机密或敏感信息。标签不适合用于私有或敏感数据。
以下主题介绍如何使用 AWS Management Console AWS CLI、和 AWS SDKs使用 HealthLake 标记操作。有关更多信息,请参阅AWS 一般参考 指南中的为AWS 资源添加标签。
标记 HealthLake 数据存储
TagResource用于标记 HealthLake 数据存储。以下菜单提供了操作步骤 AWS Management Console 和 AWS CLI 和的代码示例 AWS SDKs。有关更多信息,请参阅 AWS HealthLake API 参考中的 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"}]'
此命令不生成任何输出。
有关更多信息,请参阅《AWS HealthLake 开发人员指南》中的向数据存储添加标签。 。
- 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
找不到所需的内容? 使用本页右侧边栏上的 “提供反馈” 链接请求代码示例。
-
登录 HealthLake 控制台上的数据存储页面。
-
选择数据存储。
数据存储详细信息页面将会打开。
-
在 标签 部分中,选择 管理标签。
将打开管理标签页面。
-
选择 添加新标签。
-
输入一个 键和可选的 值(可选)。
-
选择保存。
ListTagsForResource用于列出 HealthLake 数据存储的标签。以下菜单提供了操作步骤 AWS Management Console 和 AWS CLI 和的代码示例 AWS SDKs。有关更多信息,请参阅 AWS HealthLake API 参考中的 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"
}
}
有关更多信息,请参阅《 AWS HealthLake 开发人员指南》AWS HealthLake中的为资源添加标签。
- 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
找不到所需的内容? 使用本页右侧边栏上的 “提供反馈” 链接请求代码示例。
-
登录 HealthLake 控制台上的数据存储页面。
-
选择数据存储。
数据存储详细信息页面将会打开。在标签部分下,列出了所有数据存储标签。
取消对数据存储的标 HealthLake 记
UntagResource用于从 HealthLake 数据存储中移除标签。以下菜单提供了操作步骤 AWS Management Console 和 AWS CLI 和的代码示例 AWS SDKs。有关更多信息,请参阅 AWS HealthLake API 参考中的 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"]'
此命令不生成任何输出。
有关更多信息,请参阅《AWS HealthLake 开发人员指南》中的从数据存储中移除标签。
- 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
找不到所需的内容? 使用本页右侧边栏上的 “提供反馈” 链接请求代码示例。
-
登录 HealthLake 控制台上的数据存储页面。
-
选择数据存储。
数据存储详细信息页面将会打开。
-
在 标签 部分中,选择 管理标签。
将打开管理标签页面。
-
在标签旁选择 移除,以移除标签。
-
选择保存。