

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 更新 HealthLake 資料存放區
<a name="managing-data-stores-update"></a>

使用 `UpdateFHIRDatastore`更新現有 AWS HealthLake 資料存放區的組態。您可以更新資料存放區名稱、自然語言處理 (NLP) 組態、分析組態、預設 FHIR 驗證設定檔，以及身分提供者組態。您在建立資料存放區時選擇的加密組態無法變更。

**注意**  
更新身分提供者組態會將其完全取代，包括您要保留的每個欄位。您省略的任何欄位都會清除。

下列選單提供 AWS CLI 和 AWS SDKs的範例。如需詳細資訊，請參閱 *AWS HealthLake API 參考*中的 [https://docs.aws.amazon.com/healthlake/latest/APIReference/API_UpdateFHIRDatastore.html](https://docs.aws.amazon.com/healthlake/latest/APIReference/API_UpdateFHIRDatastore.html)。

**Important (重要)**  
NLP 和分析變更會透過非同步工作流程套用：資料存放區狀態會變更為 `UPDATING`，並在更新完成`ACTIVE`時傳回 ，否則會顯示 `UPDATE_FAILED` 。資料存放區名稱、FHIR 驗證設定檔和身分提供者變更會立即生效，而且不會變更狀態。一次只能有一個資料存放區的更新正在進行中；當資料存放區執行時提交的第二個更新會傳回 `ConflictException`。使用 `DescribeFHIRDatastore` 追蹤更新的狀態。

**更新 HealthLake 資料存放區**  
根據您的存取偏好設定選擇選單 AWS HealthLake。

## AWS CLI 和 SDKs
<a name="managing-data-stores-update-cli-sdk"></a>

------
#### [ AWS CLI ]

**範例 1：重新命名資料存放區**

```
aws healthlake update-fhir-datastore \
  --datastore-id "{{datastore-id}}" \
  --datastore-name "RenamedFhirDatastore"
```

**範例 2：啟用 NLP**

```
aws healthlake update-fhir-datastore \
  --datastore-id "{{datastore-id}}" \
  --nlp-configuration '{ "Status": "ENABLED" }'
```

**範例 3：暫停分析**

```
aws healthlake update-fhir-datastore \
  --datastore-id "{{datastore-id}}" \
  --analytics-configuration '{ "Status": "PAUSED" }'
```

**範例 4：更新預設 FHIR 驗證設定檔**

```
aws healthlake update-fhir-datastore \
  --datastore-id "{{datastore-id}}" \
  --profile-configuration '{ "DefaultProfiles": ["us-core-3.1.1", "carin-bb-2.0.0"] }'
```

回應會傳回完整 `DatastoreProperties`- 與 傳回的形狀相同`DescribeFHIRDatastore`。

```
{
    "DatastoreProperties": {
        "DatastoreId": "{{datastore-id}}",
        "DatastoreArn": "arn:aws:healthlake:us-east-1:{{account-id}}:datastore/{{datastore-id}}",
        "DatastoreName": "RenamedFhirDatastore",
        "DatastoreStatus": "UPDATING",
        "DatastoreTypeVersion": "R4",
        "DatastoreEndpoint": "https://healthlake.us-east-1.amazonaws.com/datastore/{{datastore-id}}/r4/",
        "NlpConfiguration": { "Status": "ENABLING" },
        "AnalyticsConfiguration": { "Status": "PAUSING" },
        "ProfileConfiguration": { "DefaultProfiles": [ "us-core-3.1.1", "carin-bb-2.0.0" ] },
        "IdentityProviderConfiguration": {
            "AuthorizationStrategy": "SMART_ON_FHIR_V1",
            "FineGrainedAuthorizationEnabled": true
        }
    }
}
```

如需 API 詳細資訊，請參閱 *AWS CLI 命令參考*中的 [update-fhir-datastore](https://docs.aws.amazon.com/cli/latest/reference/healthlake/update-fhir-datastore.html)。

------
#### [ Python ]

**適用於 Python 的 SDK (Boto3)**

```
def update_fhir_datastore(
    self,
    datastore_id: str,
    **kwargs,
) -> dict[str, any]:
    """
    Updates the configuration of an existing HealthLake data store.

    Pass any of DatastoreName, NlpConfiguration, AnalyticsConfiguration,
    ProfileConfiguration, or IdentityProviderConfiguration as keyword
    arguments. Omitted fields are left unchanged.

    :param datastore_id: The ID of the data store to update.
    :return: The response, including the full DatastoreProperties.
    """
    try:
        return self.health_lake_client.update_fhir_datastore(
            DatastoreId=datastore_id, **kwargs
        )
    except ClientError as err:
        logger.exception(
            "Couldn't update data store %s. Here's why: %s",
            datastore_id,
            err.response["Error"]["Message"],
        )
        raise
```

如需 API 詳細資訊，請參閱《適用於 *AWS Python (Boto3) 的 SDK API 參考*》中的 [UpdateFHIRDatastore](https://docs.aws.amazon.com/goto/boto3/healthlake-2017-07-01/UpdateFHIRDatastore)。

------

**可用性範例**  
找不到所需的內容嗎？ 使用此頁面右側的**提供意見回饋**連結來請求程式碼範例。