本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
標記 HealthLake 資料存放區
您可以將中繼資料以標籤形式指派給 HealthLake 資料存放區。每個標籤都是由使用者定義的金鑰和值組成的標籤。標籤可協助您管理、識別、組織、搜尋和篩選資料存放區。
請勿在標籤中存放受保護醫療資訊 (PHI)、個人身分識別資訊 (PII) 或其他機密或敏感資訊。標籤不適用於私有或敏感資料。
下列主題說明如何使用 AWS 管理主控台、 AWS CLI和 AWS SDKs 來使用 HealthLake 標記操作。如需詳細資訊,請參閱《 AWS 一般參考 指南》中的標記您的 AWS 資源。
標記 HealthLake 資料存放區
使用 TagResource標記 HealthLake 資料存放區。下列功能表提供 AWS CLI AWS SDKs 的 AWS 管理主控台 和 程式碼範例程序。如需詳細資訊,請參閱 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 主控台上的資料存放區頁面。
-
選擇資料存放區。
資料存放區詳細資訊頁面隨即開啟。
-
在標籤區段下,選擇管理標籤。
隨即開啟管理標籤頁面。
-
選擇 Add new tag (新增標籤)。
-
輸入金鑰和值 (選用)。
-
選擇儲存。
使用 ListTagsForResource 列出 HealthLake 資料存放區的標籤。下列功能表提供 AWS CLI AWS SDKs 的 AWS 管理主控台 和 程式碼範例程序。如需詳細資訊,請參閱 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 開發人員指南》中的在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 資料存放區
使用 從 HealthLake 資料存放區UntagResource移除標籤。下列功能表提供 AWS CLI AWS SDKs 的 AWS 管理主控台 和 程式碼範例程序。如需詳細資訊,請參閱 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 主控台上的資料存放區頁面。
-
選擇資料存放區。
資料存放區詳細資訊頁面隨即開啟。
-
在標籤區段下,選擇管理標籤。
隨即開啟管理標籤頁面。
-
選擇您要移除之標籤旁的移除。
-
選擇儲存。