本頁說明如何使用 Identity and Access Management (IAM) 權限,控管 Cloud Healthcare API 資料集和資料存放區的存取權。您可以使用 IAM 管理要讓哪些人存取資料集和資料儲存庫。如要進一步瞭解 Cloud Healthcare API 的 IAM,請參閱存取權控管。
IAM 政策總覽
資源的存取權可透過 IAM 政策進行管理。政策包含名為 bindings
的陣列。這個陣列包含一組繫結,也就是主體 (例如使用者帳戶或服務帳戶) 與角色之間的關聯。政策可使用 JSON 或 YAML 來表示。
下列範例政策顯示 user-1@example.com
已獲授 roles/healthcare.datasetAdmin
角色,而 user-2@example.com
和 service-account-13@appspot.gserviceaccount.com
則獲授 roles/healthcare.datasetViewer
角色:
{ "etag":"bytes", "bindings": [ { "role":"roles/healthcare.datasetAdmin", "members": [ "user:user-1@example.com" ] }, { "role":"roles/healthcare.datasetViewer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com" ] } ] }
如要更新資源政策,請使用「讀取 - 修改 - 寫入」模式。建立、修改及撤銷使用者存取權的方法相同。
如要更新政策,請完成下列步驟:
- 呼叫資源的
getIamPolicy()
方法,讀取目前的政策。舉例來說,如要讀取資料集的現行政策,請呼叫projects.locations.datasets.getIamPolicy
。 - 使用文字編輯器或透過程式來編輯傳回的政策,藉此新增或移除任何適用的主體及其授予的角色。
- 呼叫資源的
setIamPolicy()
方法,寫入更新的政策。舉例來說,如要寫入資料集的更新政策,請呼叫projects.locations.datasets.setIamPolicy
。
搭配同意聲明儲存庫使用 IAM
以下各節說明如何取得、修改及設定同意聲明存放區的政策。這些章節以以下範例政策為基礎:
{ "etag":"bytes", "bindings": [ { "role":"roles/healthcare.consentStoreAdmin", "members": [ "user:user-1@example.com" ] }, { "role":"roles/healthcare.consentReader", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com" ] } ] }
取得政策
下列範例說明如何讀取同意聲明存放區層級的 IAM 政策。詳情請參閱 projects.locations.datasets.consentStores.getIamPolicy
。
控制台
如要查看同意聲明存放區的 IAM 政策:
- 前往 Google Cloud 控制台的「資料集」頁面。
- 按一下含有同意聲明儲存庫的資料集 ID,然後選取要取得政策的同意聲明儲存庫。
- 按一下「顯示資訊面板」。
- 如要查看指派給角色的主體,請展開該角色。
gcloud
如要查看同意事項商店的 IAM 政策,請執行 gcloud healthcare consent-stores get-iam-policy
指令。指定同意聲明商店名稱、資料集名稱和位置。
gcloud healthcare consent-stores get-iam-policy CONSENT_STORE_ID \ --dataset=DATASET_ID \ --location=LOCATION
如果要求成功,系統會顯示繫結。
bindings: - members: - user:user-1@example.com role: roles/healthcare.consentStoreAdmin - serviceAccount:service-account-13@appspot.gserviceaccount.com - user:user-2@example.com role: roles/healthcare.consentReader etag: bytes version: VERSION_NUMBER
Node.js
Python
curl
如要讀取同意聲明儲存庫的 IAM 政策,請發出 GET
要求,並指定資料集名稱、同意聲明儲存庫名稱和存取權權杖。
以下範例顯示使用 curl
的 GET
要求:
curl -X GET \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID:getIamPolicy"
回應如下:
{ "etag":"bytes", "bindings": [ { "role":"roles/healthcare.consentStoreAdmin", "members": [ "user:user-1@example.com" ] }, { "role":"roles/healthcare.consentReader", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com" ] } ] }
PowerShell
如要讀取同意聲明儲存庫的 IAM 政策,請發出 GET
要求,並指定資料集名稱、同意聲明儲存庫名稱和存取權權杖。
下列範例顯示如何使用 Windows PowerShell 提出 GET
要求:
$cred = gcloud auth application-default print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Get ` -Headers $headers ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID:getIamPolicy" | Select-Object -Expand Content
回應如下:
{ "etag":"bytes", "bindings": [ { "role":"roles/healthcare.consentStoreAdmin", "members": [ "user:user-1@example.com" ] }, { "role":"roles/healthcare.consentReader", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com" ] } ] }
修改政策
下列範例會將 roles/healthcare.consentReader
角色授予新使用者。詳情請參閱 projects.locations.datasets.consentStores.setIamPolicy
。
設定政策
控制台
如要設定同意聲明存放區層級的 IAM 政策,請完成下列步驟:
- 前往 Google Cloud 控制台的「資料集」頁面。
- 按一下含有同意聲明儲存庫的資料集 ID,然後選取要設定政策的同意聲明儲存庫。
- 按一下「顯示資訊面板」。
- 按一下「新增主體」。
- 在「New principals」(新增主體) 欄位中,輸入需要存取同意聲明商店的一或多個身分。
- 在「Select a role」(選取角色) 清單中,選取「Cloud Healthcare」下要授予的權限。例如 Healthcare Consent Store Viewer。
- 按一下 [儲存]。
gcloud
透過程式或使用文字編輯器修改擷取的政策,以授予或撤銷使用者的角色。政策變更時,etag
值也會變更,因此您必須指定目前的值。
如要授予新使用者角色,請將他們的電子郵件地址附加至 roles/healthcare.consentReader
繫結下的 members
陣列:
{ "role":"roles/healthcare.consentReader", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com", "user:NEW_USER_EMAIL_ADDRESS" ] }
members
陣列中刪除其電子郵件地址。如要撤銷最後一個具有角色的主體存取權,請刪除該角色的 bindings
陣列。政策中不得有空白 bindings
陣列。
修改政策以授予適用的角色後,請執行適當的 set-iam-policy
指令來進行變更。如要設定同意聲明商店層級政策,請執行 gcloud healthcare consent-stores set-iam-policy
指令。指定同意聲明儲存庫名稱、資料集名稱、位置,以及您建立的政策檔案路徑。
gcloud healthcare consent-stores set-iam-policy CONSENT_STORE_ID \ --dataset=DATASET_ID \ --location=LOCATION \ POLICY_FILE_NAME
如果要求成功,系統會顯示同意聲明商店名稱和繫結。
Updated IAM policy for consentStore [CONSENT_STORE_ID]. bindings: - members: - user:user-1@example.com role: roles/healthcare.consentStoreAdmin - serviceAccount:service-account-13@appspot.gserviceaccount.com - user:user-2@example.com - user:NEW_USER_EMAIL_ADDRESS role: roles/healthcare.consentReader etag: bytes version: VERSION_NUMBER
Node.js
Python
curl
透過程式或使用文字編輯器修改擷取的政策,以授予或撤銷使用者的角色。政策變更時,etag
值也會變更,因此您必須指定目前的值。
如要授予新使用者角色,請將他們的電子郵件地址附加至 roles/healthcare.consentReader
繫結下的 members
陣列:
{ "role":"roles/healthcare.consentReader", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com", "user:NEW_USER_EMAIL_ADDRESS" ] }
members
陣列中刪除其電子郵件地址。如要撤銷最後一個具有角色的主體存取權,請刪除該角色的 bindings
陣列。政策中不得有空白 bindings
陣列。
修改政策以授予適用的角色後,請呼叫 projects.locations.datasets.consentStores.setIamPolicy
以進行更新。
如要設定同意事項儲存庫層級的 IAM 政策,請提出 POST
要求,並指定資料集名稱、同意事項儲存庫名稱、政策和存取權杖。
以下範例說明如何使用 curl
提出 POST
要求,將現有的 roles/healthcare.consentReader
角色授予新使用者:
Policy
。
curl -X POST \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ --data "{ 'policy': { 'bindings': [ { 'role':'roles/healthcare.consentStoreAdmin', 'members': [ 'user:user-1@example.com' ] }, { 'role':'roles/healthcare.consentReader', 'members': [ 'serviceAccount:service-account-13@appspot.gserviceaccount.com', 'user:user-2@example.com', 'user:NEW_USER_EMAIL_ADDRESS' ] } ] } }" "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID:setIamPolicy"
回應如下:
{ "etag":"bytes", "bindings": [ { "role":"roles/healthcare.consentStoreAdmin", "members": [ "user:user-1@example.com" ] }, { "role":"roles/healthcare.consentReader", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com", "user:NEW_USER_EMAIL_ADDRESS" ] } ] }
PowerShell
透過程式或使用文字編輯器修改擷取的政策,以授予或撤銷使用者的角色。政策變更時,etag
值也會變更,因此您必須指定目前的值。
如要授予新使用者角色,請將他們的電子郵件地址附加至 roles/healthcare.consentReader
繫結下的 members
陣列:
{ "role":"roles/healthcare.consentReader", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com", "user:NEW_USER_EMAIL_ADDRESS" ] }
members
陣列中刪除其電子郵件地址。如要撤銷最後一個具有角色的主體存取權,請刪除該角色的 bindings
陣列。政策中不得有空白 bindings
陣列。
修改政策以授予適用的角色後,請呼叫 projects.locations.datasets.consentStores.setIamPolicy
以進行更新。
如要設定同意事項儲存庫層級的 IAM 政策,請提出 POST
要求,並指定資料集名稱、同意事項儲存庫名稱、政策和存取權杖。
下列範例說明如何使用 Windows PowerShell 提出 POST
要求,將現有 roles/healthcare.consentReader
角色授予新使用者:
Policy
。
$cred = gcloud auth application-default print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Post ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -Body "{ 'policy': { 'bindings': [ { 'role': 'roles/healthcare.consentStoreAdmin', 'members': [ 'user:user-1@example.com', ] }, { 'role': 'roles/healthcare.consentReader', 'members': [ 'serviceAccount:service-account-13@appspot.gserviceaccount.com', 'user:user-2@example.com', 'user:NEW_USER_EMAIL_ADDRESS' ] } ] } }" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID:setIamPolicy" | Select-Object -Expand Content
回應如下:
{ "etag":"bytes", "bindings": [ { "role":"roles/healthcare.consentStoreAdmin", "members": [ "user:user-1@example.com" ] }, { "role":"roles/healthcare.consentReader", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com", "user:NEW_USER_EMAIL_ADDRESS" ] } ] }
搭配資料集使用 IAM
以下各節說明如何取得、修改及設定資料集的政策。這些章節以以下範例政策為基礎:
{ "etag":"bytes", "bindings": [ { "role":"roles/healthcare.datasetAdmin", "members": [ "user:user-1@example.com" ] }, { "role":"roles/healthcare.datasetViewer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com" ] } ] }
取得政策
下列範例說明如何讀取資料集層級的 IAM 政策。詳情請參閱 projects.locations.datasets.getIamPolicy
。
curl
如要讀取資料集的 IAM 政策,請提出 GET
要求,並指定資料集名稱和存取權權杖。
以下範例顯示使用 curl
的 GET
要求:
curl -X GET \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID:getIamPolicy"
回應如下:
{ "etag":"bytes", "bindings": [ { "role":"roles/healthcare.datasetAdmin", "members": [ "user:user-1@example.com" ] }, { "role":"roles/healthcare.datasetViewer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com" ] } ] }
PowerShell
如要查看資料集的 IAM 政策,請發出 GET
要求,並指定資料集名稱和存取權權杖。
下列範例顯示如何使用 Windows PowerShell 提出 GET
要求:
$cred = gcloud auth application-default print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Get ` -Headers $headers ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID:getIamPolicy" | Select-Object -Expand Content
回應如下:
{ "etag":"bytes", "bindings": [ { "role":"roles/healthcare.datasetAdmin", "members": [ "user:user-1@example.com" ] }, { "role":"roles/healthcare.datasetViewer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com" ] } ] }
控制台
如要查看資料集的 IAM 政策:- 前往 Google Cloud 控制台的「資料集」頁面。
- 選取資料集,然後按一下「顯示資訊面板」。
- 如要查看指派給角色的主體,請展開該角色。
gcloud
如要查看資料集的 IAM 政策,請執行 gcloud healthcare datasets get-iam-policy
指令。指定資料集名稱和位置。
gcloud healthcare datasets get-iam-policy DATASET_ID \ --location=LOCATION
如果要求成功,系統會顯示繫結。
bindings: - members: - serviceAccount:service-account-13@appspot.gserviceaccount.com - user:user-2@example.com role: roles/healthcare.datasetViewer etag: bytes version: VERSION_NUMBER
Go
Java
Node.js
Python
修改政策
下列範例會將 roles/healthcare.datasetViewer
角色授予新使用者:
設定政策
控制台
如要設定資料集層級的身分與存取權管理政策,請完成下列步驟:
- 前往 Google Cloud 控制台的「資料集」頁面。
- 選取要設定政策的資料集,然後按一下「顯示資訊面板」。
- 按一下「新增主體」。
- 在「New principals」(新增主體) 欄位中,輸入需要存取資料集的一或多個身分。
- 在「Select a role」(選取角色) 清單中,選取「Cloud Healthcare」下要授予的權限。例如 Healthcare 資料集檢視者。
- 按一下 [儲存]。
gcloud
透過程式或使用文字編輯器修改擷取的政策,以授予或撤銷使用者的角色。政策變更時,etag
值也會變更,因此您必須指定目前的值。
如要授予新使用者角色,請將他們的電子郵件地址附加至 roles/healthcare.datasetViewer
繫結下的 members
陣列:
{ "role":"roles/healthcare.datasetViewer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com", "user:NEW_USER_EMAIL_ADDRESS" ] }
members
陣列中刪除其電子郵件地址。如要撤銷最後一個具有角色的主體存取權,請刪除該角色的 bindings
陣列。政策中不得有空白 bindings
陣列。
修改政策以授予適用的角色後,請執行適當的 set-iam-policy
指令來進行變更。如要設定資料集層級政策,請執行 gcloud healthcare datasets set-iam-policy
指令。指定資料集名稱、位置,以及您建立的政策檔案路徑。
gcloud healthcare datasets set-iam-policy DATASET_ID \ --location=LOCATION \ POLICY_FILE_NAME
如果要求成功,系統會顯示資料集名稱和繫結。
Updated IAM policy for dataset [DATASET_ID]. bindings: - members: - serviceAccount:service-account-13@appspot.gserviceaccount.com - user:user-2@example.com role: roles/healthcare.datasetAdmin - user:user-1@example.com - user:NEW_USER_EMAIL_ADDRESS role: roles/healthcare.datasetViewer etag: bytes version: VERSION_NUMBER
curl
透過程式或使用文字編輯器修改擷取的政策,以授予或撤銷使用者的角色。政策變更時,etag
值也會變更,因此您必須指定目前的值。
如要授予新使用者角色,請將他們的電子郵件地址附加至 roles/healthcare.datasetViewer
繫結下的 members
陣列:
{ "role":"roles/healthcare.datasetViewer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com", "user:NEW_USER_EMAIL_ADDRESS" ] }
members
陣列中刪除其電子郵件地址。如要撤銷最後一個具有角色的主體存取權,請刪除該角色的 bindings
陣列。政策中不得有空白 bindings
陣列。
修改政策以授予適用的角色後,請呼叫 projects.locations.datasets.setIamPolicy
以進行更新。
如要設定資料集層級的 IAM 政策,請提出 POST
要求,並指定資料集名稱、政策和存取權權杖。
以下範例說明如何使用 curl
提出 POST
要求,將現有的 roles/healthcare.datasetViewer
角色授予新使用者:
Policy
。
curl -X POST \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ --data "{ 'policy': { 'bindings': [ { 'role':'roles/healthcare.datasetAdmin', 'members': [ 'user:user-1@example.com' ] }, { 'role':'roles/healthcare.datasetViewer', 'members': [ 'serviceAccount:service-account-13@appspot.gserviceaccount.com', 'user:user-2@example.com', 'user:NEW_USER_EMAIL_ADDRESS' ] } ] } }" "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID:setIamPolicy"
回應如下:
{ "etag":"bytes", "bindings": [ { "role":"roles/healthcare.datasetAdmin", "members": [ "user:user-1@example.com" ] }, { "role":"roles/healthcare.datasetViewer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com", "user:NEW_USER_EMAIL_ADDRESS" ] } ] }
PowerShell
透過程式或使用文字編輯器修改擷取的政策,以授予或撤銷使用者的角色。政策變更時,etag
值也會變更,因此您必須指定目前的值。
如要授予新使用者角色,請將他們的電子郵件地址附加至 roles/healthcare.datasetViewer
繫結下的 members
陣列:
{ "role":"roles/healthcare.datasetViewer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com", "user:NEW_USER_EMAIL_ADDRESS" ] }
members
陣列中刪除其電子郵件地址。如要撤銷最後一個具有角色的主體存取權,請刪除該角色的 bindings
陣列。政策中不得有空白 bindings
陣列。
修改政策以授予適用的角色後,請呼叫 projects.locations.datasets.setIamPolicy
以進行更新。
如要設定資料集層級的 IAM 政策,請提出 POST
要求,並指定資料集名稱、政策和存取權權杖。
下列範例說明如何使用 Windows PowerShell 提出 POST
要求,將現有 roles/healthcare.datasetViewer
角色授予新使用者:
Policy
。
$cred = gcloud auth application-default print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Post ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -Body "{ 'policy': { 'bindings': [ { 'role': 'roles/healthcare.datasetAdmin', 'members': [ 'user:user-1@example.com' ] }, { 'role': 'roles/healthcare.datasetViewer', 'members': [ 'serviceAccount:service-account-13@appspot.gserviceaccount.com', 'user:user-2@example.com', 'user:NEW_USER_EMAIL_ADDRESS' ] } ] } }" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID:setIamPolicy" | Select-Object -Expand Content
回應如下:
{ "etag":"bytes", "bindings": [ { "role":"roles/healthcare.datasetAdmin", "members": [ "user:user-1@example.com" ] }, { "role":"roles/healthcare.datasetViewer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com", "user:NEW_USER_EMAIL_ADDRESS" ] } ] }
Go
Java
Node.js
Python
搭配 DICOM 儲存區使用 IAM
以下各節說明如何取得、修改及設定 DICOM 存放區的政策。這些章節以以下範例政策為基礎:
{ "etag":"bytes", "bindings": [ { "role":"roles/healthcare.dicomStoreAdmin", "members": [ "user:user-1@example.com" ] }, { "role":"roles/healthcare.dicomViewer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com" ] } ] }
取得政策
下列範例說明如何讀取 DICOM 儲存庫層級的 IAM 政策。詳情請參閱 projects.locations.datasets.dicomStores.getIamPolicy
。
控制台
如要查看 DICOM 儲存庫的身分與存取權管理政策:
- 前往 Google Cloud 控制台的「資料集」頁面。
- 按一下含有 DICOM 儲存庫的資料集 ID,然後選取要取得政策的 DICOM 儲存庫。
- 按一下「顯示資訊面板」。
- 如要查看指派給角色的主體,請展開該角色。
gcloud
如要查看 DICOM 儲存庫的 IAM 政策,請執行 gcloud healthcare dicom-stores get-iam-policy
指令。指定 DICOM 儲存庫名稱、資料集名稱和位置。
gcloud healthcare dicom-stores get-iam-policy DICOM_STORE_ID \ --dataset=DATASET_ID \ --location=LOCATION
如果要求成功,系統會顯示繫結。
bindings: - members: - user:user-1@example.com role: roles/healthcare.dicomStoreAdmin - serviceAccount:service-account-13@appspot.gserviceaccount.com - user:user-2@example.com role: roles/healthcare.dicomViewer etag: bytes version: VERSION_NUMBER
Go
Java
Node.js
Python
curl
如要讀取 DICOM 儲存庫的 IAM 政策,請發出 GET
要求,並指定資料集名稱、DICOM 儲存庫名稱和存取權權杖。
以下範例顯示使用 curl
的 GET
要求:
curl -X GET \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/dicomStores/DICOM_STORE_ID:getIamPolicy"
回應如下:
{ "etag":"bytes", "bindings": [ { "role":"roles/healthcare.dicomStoreAdmin", "members": [ "user:user-1@example.com" ] }, { "role":"roles/healthcare.dicomViewer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com" ] } ] }
PowerShell
如要讀取 DICOM 儲存庫的 IAM 政策,請發出 GET
要求,並指定資料集名稱、DICOM 儲存庫名稱和存取權權杖。
下列範例顯示如何使用 Windows PowerShell 提出 GET
要求:
$cred = gcloud auth application-default print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Get ` -Headers $headers ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/dicomStores/DICOM_STORE_ID:getIamPolicy" | Select-Object -Expand Content
回應如下:
{ "etag":"bytes", "bindings": [ { "role":"roles/healthcare.dicomStoreAdmin", "members": [ "user:user-1@example.com" ] }, { "role":"roles/healthcare.dicomViewer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com" ] } ] }
修改政策
下列範例會將 roles/healthcare.dicomViewer
角色授予新使用者。詳情請參閱 projects.locations.datasets.dicomStores.setIamPolicy
。
設定政策
控制台
如要設定 DICOM 儲存庫層級的身分與存取權管理政策,請完成下列步驟:
- 前往 Google Cloud 控制台的「資料集」頁面。
- 按一下含有 DICOM 儲存庫的資料集 ID,然後選取要設定政策的 DICOM 儲存庫。
- 按一下「顯示資訊面板」。
- 按一下「新增主體」。
- 在「新增主體」欄位中,輸入需要存取 DICOM 存放區的一或多個身分。
- 在「Select a role」(選取角色) 清單中,選取「Cloud Healthcare」下要授予的權限。例如 Healthcare DICOM Store 檢視者。
- 按一下 [儲存]。
gcloud
透過程式或使用文字編輯器修改擷取的政策,以授予或撤銷使用者的角色。政策變更時,etag
值也會變更,因此您必須指定目前的值。
如要授予新使用者角色,請將他們的電子郵件地址附加至 roles/healthcare.dicomViewer
繫結下的 members
陣列:
{ "role":"roles/healthcare.dicomViewer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com", "user:NEW_USER_EMAIL_ADDRESS" ] }
members
陣列中刪除其電子郵件地址。如要撤銷最後一個具有角色的主體存取權,請刪除該角色的 bindings
陣列。政策中不得有空白 bindings
陣列。
修改政策以授予適用的角色後,請執行適當的 set-iam-policy
指令來進行變更。如要設定 DICOM 商店層級政策,請執行 gcloud healthcare dicom-stores set-iam-policy
指令。指定 DICOM 儲存庫名稱、資料集名稱、位置,以及您建立的政策檔案路徑。
gcloud healthcare dicom-stores set-iam-policy DICOM_STORE_ID \ --dataset=DATASET_ID \ --location=LOCATION \ POLICY_FILE_NAME
如果要求成功,系統會顯示 DICOM 儲存名稱和繫結。
Updated IAM policy for dicomStore [DICOM_STORE_ID]. bindings: - members: - user:user-1@example.com role: roles/healthcare.dicomStoreAdmin - serviceAccount:service-account-13@appspot.gserviceaccount.com - user:user-2@example.com - user:NEW_USER_EMAIL_ADDRESS role: roles/healthcare.dicomViewer etag: bytes version: VERSION_NUMBER
Go
Java
Node.js
Python
curl
透過程式或使用文字編輯器修改擷取的政策,以授予或撤銷使用者的角色。政策變更時,etag
值也會變更,因此您必須指定目前的值。
如要授予新使用者角色,請將他們的電子郵件地址附加至 roles/healthcare.dicomViewer
繫結下的 members
陣列:
{ "role":"roles/healthcare.dicomViewer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com", "user:NEW_USER_EMAIL_ADDRESS" ] }
members
陣列中刪除其電子郵件地址。如要撤銷最後一個具有角色的主體存取權,請刪除該角色的 bindings
陣列。政策中不得有空白 bindings
陣列。
修改政策以授予適用的角色後,請呼叫 projects.locations.datasets.dicomStores.setIamPolicy
以進行更新。
如要設定 DICOM 儲存庫層級的身分與存取權管理政策,請提出 POST
要求,並指定資料集名稱、DICOM 儲存庫名稱、政策和存取權權杖。
以下範例說明如何使用 curl
提出 POST
要求,將現有的 roles/healthcare.dicomViewer
角色授予新使用者:
Policy
。
curl -X POST \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ --data "{ 'policy': { 'bindings': [ { 'role':'roles/healthcare.dicomStoreAdmin', 'members': [ 'user:user-1@example.com' ] }, { 'role':'roles/healthcare.dicomViewer', 'members': [ 'serviceAccount:service-account-13@appspot.gserviceaccount.com', 'user:user-2@example.com', 'user:NEW_USER_EMAIL_ADDRESS' ] } ] } }" "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/dicomStores/DICOM_STORE_ID:setIamPolicy"
回應如下:
{ "etag":"bytes", "bindings": [ { "role":"roles/healthcare.dicomStoreAdmin", "members": [ "user:user-1@example.com" ] }, { "role":"roles/healthcare.dicomViewer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com", "user:NEW_USER_EMAIL_ADDRESS" ] } ] }
PowerShell
透過程式或使用文字編輯器修改擷取的政策,以授予或撤銷使用者的角色。政策變更時,etag
值也會變更,因此您必須指定目前的值。
如要授予新使用者角色,請將他們的電子郵件地址附加至 roles/healthcare.dicomViewer
繫結下的 members
陣列:
{ "role":"roles/healthcare.dicomViewer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com", "user:NEW_USER_EMAIL_ADDRESS" ] }
members
陣列中刪除其電子郵件地址。如要撤銷最後一個具有角色的主體存取權,請刪除該角色的 bindings
陣列。政策中不得有空白 bindings
陣列。
修改政策以授予適用的角色後,請呼叫 projects.locations.datasets.dicomStores.setIamPolicy
以進行更新。
如要設定 DICOM 儲存庫層級的身分與存取權管理政策,請提出 POST
要求,並指定資料集名稱、DICOM 儲存庫名稱、政策和存取權權杖。
下列範例說明如何使用 Windows PowerShell 提出 POST
要求,將現有 roles/healthcare.dicomViewer
角色授予新使用者:
Policy
。
$cred = gcloud auth application-default print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Post ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -Body "{ 'policy': { 'bindings': [ { 'role': 'roles/healthcare.dicomStoreAdmin', 'members': [ 'user:user-1@example.com', ] }, { 'role': 'roles/healthcare.dicomViewer', 'members': [ 'serviceAccount:service-account-13@appspot.gserviceaccount.com', 'user:user-2@example.com', 'user:NEW_USER_EMAIL_ADDRESS' ] } ] } }" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/dicomStores/DICOM_STORE_ID:setIamPolicy" | Select-Object -Expand Content
回應如下:
{ "etag":"bytes", "bindings": [ { "role":"roles/healthcare.dicomStoreAdmin", "members": [ "user:user-1@example.com" ] }, { "role":"roles/healthcare.dicomViewer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com", "user:NEW_USER_EMAIL_ADDRESS" ] } ] }
搭配 FHIR 儲存庫使用 IAM
以下各節說明如何取得、修改及設定 FHIR 存放區的政策。這些章節以以下範例政策為基礎:
{ "etag":"bytes", "bindings": [ { "role":"roles/healthcare.fhirStoreAdmin", "members": [ "user:user-1@example.com" ] }, { "role":"roles/healthcare.fhirResourceReader", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com" ] } ] }
取得政策
下列範例說明如何讀取 FHIR 儲存庫層級的 IAM 政策。詳情請參閱 projects.locations.datasets.fhirStores.getIamPolicy
。
控制台
如要查看 FHIR 儲存庫的身分與存取權管理政策:
- 前往 Google Cloud 控制台的「資料集」頁面。
- 按一下包含 FHIR 儲存庫的資料集 ID,然後選取要取得政策的 FHIR 儲存庫。
- 按一下「顯示資訊面板」。
- 如要查看指派給角色的主體,請展開該角色。
gcloud
如要查看 FHIR 儲存庫的 IAM 政策,請執行 gcloud healthcare fhir-stores get-iam-policy
指令。指定 FHIR 儲存庫名稱、資料集名稱和位置。
gcloud healthcare fhir-stores get-iam-policy FHIR_STORE_ID \ --dataset=DATASET_ID \ --location=LOCATION
如果要求成功,系統會顯示繫結。
bindings: - members: - user:user-1@example.com role: roles/healthcare.fhirStoreAdmin - serviceAccount:service-account-13@appspot.gserviceaccount.com - user:user-2@example.com role: roles/healthcare.fhirResourceReader etag: bytes version: VERSION_NUMBER
Go
Java
Node.js
Python
curl
如要讀取 FHIR 儲存庫的 IAM 政策,請發出 POST
要求,並指定資料集名稱、FHIR 儲存庫名稱和存取權權杖。
以下範例顯示使用 curl
的 POST
要求:
curl -X GET \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID:getIamPolicy"
回應如下:
{ "etag":"bytes", "bindings": [ { "role":"roles/healthcare.fhirStoreAdmin", "members": [ "user:user-1@example.com" ] }, { "role":"roles/healthcare.fhirResourceReader", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com" ] } ] }
PowerShell
如要讀取 FHIR 儲存庫的 IAM 政策,請發出 POST
要求,並指定資料集名稱、FHIR 儲存庫名稱和存取權權杖。
下列範例顯示如何使用 Windows PowerShell 提出 POST
要求:
$cred = gcloud auth application-default print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Post ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID:getIamPolicy" | Select-Object -Expand Content
回應如下:
{ "etag":"bytes", "bindings": [ { "role":"roles/healthcare.fhirStoreAdmin", "members": [ "user:user-1@example.com" ] }, { "role":"roles/healthcare.fhirResourceReader", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com" ] } ] }
修改政策
下列範例會將 roles/healthcare.fhirResourceReader
角色授予新使用者。詳情請參閱 projects.locations.datasets.fhirStores.setIamPolicy
。
設定政策
控制台
如要設定 FHIR 儲存庫層級的身分與存取權管理政策,請完成下列步驟:
- 前往 Google Cloud 控制台的「資料集」頁面。
- 按一下包含 FHIR 儲存庫的資料集 ID,然後選取要設定政策的 FHIR 儲存庫。
- 按一下「顯示資訊面板」。
- 按一下「新增主體」。
- 在「New principals」(新增主體) 欄位中,輸入需要存取 FHIR 存放區的一或多個身分。
- 在「Select a role」(選取角色) 清單中,選取「Cloud Healthcare」下要授予的權限。例如 Healthcare FHIR 資源讀取者。
- 按一下 [儲存]。
gcloud
透過程式或使用文字編輯器修改擷取的政策,以授予或撤銷使用者的角色。政策變更時,etag
值也會變更,因此您必須指定目前的值。
如要授予新使用者角色,請將對方的電子郵件地址附加到 roles/healthcare.fhirResourceReader
繫結下的 members
陣列:
{ "role":"roles/healthcare.fhirResourceReader", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com", "user:NEW_USER_EMAIL_ADDRESS" ] }
members
陣列中刪除其電子郵件地址。如要撤銷最後一個具有角色的主體存取權,請刪除該角色的 bindings
陣列。政策中不得有空白 bindings
陣列。
修改政策以授予適用的角色後,請執行適當的 set-iam-policy
指令來進行變更。如要設定 FHIR 儲存庫層級的政策,請執行 gcloud healthcare fhir-stores set-iam-policy
指令。指定 FHIR 儲存庫名稱、資料集名稱、位置,以及您建立的政策檔案路徑。
gcloud healthcare fhir-stores set-iam-policy FHIR_STORE_ID \ --dataset=DATASET_ID \ --location=LOCATION \ POLICY_FILE_NAME
如果要求成功,系統會顯示 FHIR 存放區名稱和繫結。
Updated IAM policy for fhirStore [FHIR_STORE_ID]. bindings: - members: - serviceAccount:service-account-13@appspot.gserviceaccount.com - user:user-2@example.com - user:NEW_USER_EMAIL_ADDRESS role: roles/healthcare.fhirResourceReader etag: bytes version: VERSION_NUMBER
Go
Java
Node.js
Python
curl
透過程式或使用文字編輯器修改擷取的政策,以授予或撤銷使用者的角色。政策變更時,etag
值也會變更,因此您必須指定目前的值。
如要授予新使用者角色,請將對方的電子郵件地址附加到 roles/healthcare.fhirResourceReader
繫結下的 members
陣列:
{ "role":"roles/healthcare.fhirResourceReader", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com", "user:NEW_USER_EMAIL_ADDRESS" ] }
members
陣列中刪除其電子郵件地址。如要撤銷最後一個具有角色的主體存取權,請刪除該角色的 bindings
陣列。政策中不得有空白 bindings
陣列。
修改政策以授予適用的角色後,請呼叫 projects.locations.datasets.fhirStores.setIamPolicy
以進行更新。
如要設定 FHIR 儲存庫層級的身分與存取權管理政策,請提出 POST
要求,並指定資料集名稱、FHIR 儲存庫名稱、政策和存取權杖。
以下範例說明如何使用 curl
提出 POST
要求,將現有的 roles/healthcare.fhirResourceReader
角色授予新使用者:
Policy
。
curl -X POST \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ --data "{ 'policy': { 'bindings': [ { 'role':'roles/healthcare.fhirStoreAdmin', 'members': [ 'user:user-1@example.com' ] }, { 'role':'roles/healthcare.fhirResourceReader', 'members': [ 'serviceAccount:service-account-13@appspot.gserviceaccount.com', 'user:user-2@example.com', 'user:NEW_USER_EMAIL_ADDRESS' ] } ] } }" "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID:setIamPolicy"
回應如下:
{ "etag":"bytes", "bindings": [ { "role":"roles/healthcare.fhirStoreAdmin", "members": [ "user:user-1@example.com" ] }, { "role":"roles/healthcare.fhirResourceViewer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com", "user:NEW_USER_EMAIL_ADDRESS" ] } ] }
PowerShell
透過程式或使用文字編輯器修改擷取的政策,以授予或撤銷使用者的角色。政策變更時,etag
值也會變更,因此您必須指定目前的值。
如要授予新使用者角色,請將對方的電子郵件地址附加到 roles/healthcare.fhirResourceReader
繫結下的 members
陣列:
{ "role":"roles/healthcare.fhirResourceReader", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com", "user:NEW_USER_EMAIL_ADDRESS" ] }
members
陣列中刪除其電子郵件地址。如要撤銷最後一個具有角色的主體存取權,請刪除該角色的 bindings
陣列。政策中不得有空白 bindings
陣列。
修改政策以授予適用的角色後,請呼叫 projects.locations.datasets.fhirStores.setIamPolicy
以進行更新。
如要設定 FHIR 儲存庫層級的身分與存取權管理政策,請提出 POST
要求,並指定資料集名稱、FHIR 儲存庫名稱、政策和存取權杖。
下列範例說明如何使用 Windows PowerShell 提出 POST
要求,將現有 roles/healthcare.fhirResourceReader
角色授予新使用者:
Policy
。
$cred = gcloud auth application-default print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Post ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -Body "{ 'policy': { 'bindings': [ { 'role': 'roles/healthcare.fhirStoreAdmin', 'members': [ 'user:user-1@example.com', ] }, { 'role': 'roles/healthcare.fhirResourceReader', 'members': [ 'serviceAccount:service-account-13@appspot.gserviceaccount.com', 'user:user-2@example.com', 'user:NEW_USER_EMAIL_ADDRESS' ] } ] } }" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID:setIamPolicy" | Select-Object -Expand Content
回應如下:
{ "etag":"bytes", "bindings": [ { "role":"roles/healthcare.fhirStoreAdmin", "members": [ "user:user-1@example.com" ] }, { "role":"roles/healthcare.fhirResourceViewer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com", "user:NEW_USER_EMAIL_ADDRESS" ] } ] }
搭配 HL7v2 儲存庫使用 IAM
以下各節說明如何取得、修改及設定 HL7v2 存放區的政策。這些章節以以下範例政策為基礎:
{ "etag":"bytes", "bindings": [ { "role":"roles/healthcare.hl7V2StoreAdmin", "members": [ "user:user-1@example.com" ] }, { "role":"roles/healthcare.hl7V2Consumer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com" ] } ] }
取得政策
下列範例說明如何讀取 HL7v2 儲存庫層級的 IAM 政策。詳情請參閱 projects.locations.datasets.hl7V2Stores.getIamPolicy
。
控制台
如要查看 HL7v2 儲存庫的身分與存取權管理政策:
- 前往 Google Cloud 控制台的「資料集」頁面。
- 按一下含有 HL7v2 儲存庫的資料集 ID,然後選取要取得政策的 HL7v2 儲存庫。
- 按一下「顯示資訊面板」。
- 如要查看指派給角色的主體,請展開該角色。
gcloud
如要查看 HL7v2 儲存庫的身分與存取權管理政策,請執行 hl7v2-stores get-iam-policy
指令。指定 HL7v2 商店名稱、資料集名稱和位置。
gcloud healthcare hl7v2-stores get-iam-policy HL7V2_STORE_ID \ --dataset=DATASET_ID \ --location=LOCATION
如果要求成功,系統會顯示繫結。
bindings: - members: - user:user-1@example.com role: roles/healthcare.hl7v2StoreAdmin - serviceAccount:service-account-13@appspot.gserviceaccount.com - user:user-2@example.com role: roles/healthcare.hl7v2Consumer etag: bytes version: VERSION_NUMBER
curl
如要讀取 HL7v2 儲存庫的 IAM 政策,請發出 GET
要求,並指定資料集名稱、HL7v2 儲存庫名稱和存取權權杖。
以下範例顯示使用 curl
的 GET
要求:
curl -X GET \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/hl7V2Stores/HL7V2_STORE_ID:getIamPolicy"
回應如下:
{ "etag":"bytes", "bindings": [ { "role":"roles/healthcare.hl7V2StoreAdmin", "members": [ "user:user-1@example.com" ] }, { "role":"roles/healthcare.hl7V2Consumer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com" ] } ] }
PowerShell
如要讀取 HL7v2 儲存庫的 IAM 政策,請發出 GET
要求,並指定資料集名稱、HL7v2 儲存庫名稱和存取權權杖。
下列範例顯示如何使用 Windows PowerShell 提出 GET
要求:
$cred = gcloud auth application-default print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Get ` -Headers $headers ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/hl7V2Stores/HL7V2_STORE_ID:getIamPolicy" | Select-Object -Expand Content
回應如下:
{ "etag":"bytes", "bindings": [ { "role":"roles/healthcare.hl7V2StoreAdmin", "members": [ "user:user-1@example.com" ] }, { "role":"roles/healthcare.hl7V2Consumer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com" ] } ] }
Go
Java
Node.js
Python
修改政策
下列範例會將 roles/healthcare.hl7V2Consumer
角色授予新使用者。詳情請參閱 projects.locations.datasets.hl7V2Stores.setIamPolicy
。
設定政策
控制台
如要設定 HL7v2 儲存庫層級的身分與存取權管理政策,請完成下列步驟:
- 前往 Google Cloud 控制台的「資料集」頁面。
- 按一下含有 HL7v2 儲存庫的資料集 ID,然後選取要設定政策的 HL7v2 儲存庫。
- 按一下「顯示資訊面板」。
- 按一下「新增主體」。
- 在「New principals」(新增主體) 欄位中,輸入需要存取 HL7v2 儲存區的一或多個身分。
- 在「Select a role」(選取角色) 清單中,選取「Cloud Healthcare」下要授予的權限。例如:Healthcare HL7v2 訊息使用者。
- 按一下 [儲存]。
gcloud
透過程式或使用文字編輯器修改擷取的政策,以授予或撤銷使用者的角色。政策變更時,etag
值也會變更,因此您必須指定目前的值。
如要授予新使用者角色,請將對方的電子郵件地址附加到 roles/healthcare.hl7V2Consumer
繫結下的 members
陣列:
{ "role":"roles/healthcare.hl7V2Consumer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com", "user:NEW_USER_EMAIL_ADDRESS" ] }
members
陣列中刪除其電子郵件地址。如要撤銷最後一個具有角色的主體存取權,請刪除該角色的 bindings
陣列。政策中不得有空白 bindings
陣列。
修改政策以授予適用的角色後,請執行適當的 set-iam-policy
指令來進行變更。如要設定 HL7v2 儲存庫層級的政策,請執行 gcloud healthcare hl7v2-stores set-iam-policy
指令。指定 HL7v2 存放區名稱、資料集名稱、位置,以及您建立的政策檔案路徑。
gcloud healthcare hl7v2-stores set-iam-policy HL7V2_STORE_ID \ --dataset=DATASET_ID \ --location=LOCATION \ POLICY_FILE_NAME
如果要求成功,系統會顯示 HL7v2 存放區名稱和繫結。
Updated IAM policy for hl7v2Store [HL7V2_STORE_ID]. bindings: - members: - user:user-1@example.com role: roles/healthcare.hl7v2StoreAdmin - serviceAccount:service-account-13@appspot.gserviceaccount.com - user:user-2@example.com - user:NEW_USER_EMAIL_ADDRESS role: roles/healthcare.hl7v2Consumer etag: bytes version: VERSION_NUMBER
curl
透過程式或使用文字編輯器修改擷取的政策,以授予或撤銷使用者的角色。政策變更時,etag
值也會變更,因此您必須指定目前的值。
如要授予新使用者角色,請將對方的電子郵件地址附加到 roles/healthcare.hl7V2Consumer
繫結下的 members
陣列:
{ "role":"roles/healthcare.hl7V2Consumer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com", "user:NEW_USER_EMAIL_ADDRESS" ] }
members
陣列中刪除其電子郵件地址。如要撤銷最後一個具有角色的主體存取權,請刪除該角色的 bindings
陣列。政策中不得有空白 bindings
陣列。
修改政策以授予適用的角色後,請呼叫 projects.locations.datasets.hl7V2Stores.setIamPolicy
以進行更新。
如要設定 HL7v2 儲存庫層級的身分與存取權管理政策,請提出 POST
要求,並指定資料集名稱、HL7v2 儲存庫名稱、政策和存取權權杖。
以下範例顯示如何使用 curl
提出 POST
要求,授予新使用者現有的 roles/healthcare.hl7V2Consumer
角色。
Policy
。
curl -X POST \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ --data "{ 'policy': { 'bindings': [ { 'role':'roles/healthcare.hl7V2StoreAdmin', 'members': [ 'user:user-1@example.com' ] }, { 'role':'roles/healthcare.hl7V2Consumer', 'members': [ 'serviceAccount:service-account-13@appspot.gserviceaccount.com', 'user:user-2@example.com', 'user:NEW_USER_EMAIL_ADDRESS' ] } ] } }" "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/hl7V2Stores/HL7V2_STORE_ID:setIamPolicy"
回應如下:
{ "etag":"bytes", "bindings": [ { "role":"roles/healthcare.hl7V2StoreAdmin", "members": [ "user:user-1@example.com" ] }, { "role":"roles/healthcare.hl7V2Consumer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com", "user:NEW_USER_EMAIL_ADDRESS" ] } ] }
PowerShell
透過程式或使用文字編輯器修改擷取的政策,以授予或撤銷使用者的角色。政策變更時,etag
值也會變更,因此您必須指定目前的值。
如要授予新使用者角色,請將對方的電子郵件地址附加到 roles/healthcare.hl7V2Consumer
繫結下的 members
陣列:
{ "role":"roles/healthcare.hl7V2Consumer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com", "user:NEW_USER_EMAIL_ADDRESS" ] }
members
陣列中刪除其電子郵件地址。如要撤銷最後一個具有角色的主體存取權,請刪除該角色的 bindings
陣列。政策中不得有空白 bindings
陣列。
修改政策以授予適用的角色後,請呼叫 projects.locations.datasets.hl7V2Stores.setIamPolicy
以進行更新。
如要設定 HL7v2 儲存庫層級的身分與存取權管理政策,請提出 POST
要求,並指定資料集名稱、HL7v2 儲存庫名稱、政策和存取權權杖。
以下範例說明如何使用 curl
提出 POST
要求,將現有的 roles/healthcare.hl7V2Consumer
角色授予新使用者:
Policy
。
$cred = gcloud auth application-default print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Post ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -Body "{ 'policy': { 'bindings': [ { 'role': 'roles/healthcare.hl7V2StoreAdmin', 'members': [ 'user:user-1@example.com', ] }, { 'role': 'roles/healthcare.hl7V2Consumer', 'members': [ 'serviceAccount:service-account-13@appspot.gserviceaccount.com', 'user:user-2@example.com', 'user:NEW_USER_EMAIL_ADDRESS' ] } ] } }" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/hl7V2Stores/HL7V2_STORE_ID:setIamPolicy" | Select-Object -Expand Content
回應如下:
{ "etag":"bytes", "bindings": [ { "role":"roles/healthcare.hl7V2StoreAdmin", "members": [ "user:user-1@example.com" ] }, { "role":"roles/healthcare.hl7V2Consumer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "user:user-2@example.com", "user:NEW_USER_EMAIL_ADDRESS" ] } ] }
Go
Java
Node.js
Python
搭配 Healthcare Natural Language API 使用 IAM
以下各節說明如何取得、修改及設定 Healthcare Natural Language API 的政策。這些章節以以下範例政策為起點:
{ "etag":"bytes", "bindings": [ { "role":"roles/healthcare.nlpServiceViewer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com" ] } ] }
取得政策
下列範例說明如何讀取專案層級的 IAM 政策。詳情請參閱 projects.getIamPolicy
方法。
curl
如要讀取專案的 IAM 政策,請發出 POST
要求,並指定專案名稱和存取權權杖。
以下範例顯示使用 curl
的 POST
要求:
curl -X GET \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ "https://cloudresourcemanager.googleapis.com/v1/projects/PROJECT_ID:getIamPolicy"
回應如下:
{ "etag":"bytes", "bindings": [ { "role":"roles/healthcare.nlpServiceViewer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com" ] } ] }
PowerShell
如要查看專案的 IAM 政策,請發出 POST
要求,並指定專案名稱和存取權權杖。
下列範例顯示如何使用 Windows PowerShell 提出 POST
要求:
$cred = gcloud auth application-default print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method POST ` -Headers $headers ` -Uri "https://cloudresourcemanager.googleapis.com/v1/projects/PROJECT_ID:getIamPolicy" | Select-Object -Expand Content
回應如下:
{ "etag":"bytes", "bindings": [ { "role":"roles/healthcare.nlpServiceViewer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com" ] } ] }
控制台
如要查看專案的 IAM 政策,請完成下列步驟:
- 前往 Google Cloud 控制台的「IAM」頁面。
- 如要查看指派給角色的主體,請按一下「角色」,然後展開角色。
gcloud
如要查看專案的 IAM 政策,請執行 gcloud projects get-iam-policy
指令。在要求中指定專案名稱。
gcloud projects get-iam-policy PROJECT_ID
如果要求成功,系統會顯示繫結。
bindings: - members: - serviceAccount:service-account-13@appspot.gserviceaccount.com role: roles/healthcare.nlpServiceViewer etag: bytes version: VERSION_NUMBER
修改政策
下列範例會將 roles/healthcare.nlpServiceViewer
角色授予服務。詳情請參閱 projects.setIamPolicy
的說明。
設定政策
控制台
如要設定專案層級的 IAM 政策,請完成下列步驟:
- 前往 Google Cloud 控制台的「IAM」頁面。
- 按一下主體旁的「編輯」按鈕,或按一下「新增主體」,然後在「新增主體」欄位中,輸入一或多個需要存取專案的身分。
- 在「Select a role」(請選擇角色) 清單中,依序選取「Cloud Healthcare」(Cloud Healthcare) 和「Healthcare Natural Language Service Viewer」(Healthcare Natural Language Service 檢視者)。
- 按一下 [儲存]。
gcloud
透過程式或使用文字編輯器修改擷取的政策,以授予或撤銷使用者的角色。政策變更時,etag
值也會變更,因此您必須指定目前的值。
如要將角色授予新服務帳戶,請將服務帳戶的電子郵件地址新增至 roles/healthcare.nlpServiceViewer
繫結下方的 members
陣列:
{ "role":"roles/healthcare.nlpServiceViewer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "serviceAccount:NEW_SERVICE_ACCOUNT_EMAIL_ADDRESS" ] }
members
陣列中刪除其電子郵件地址。如要撤銷最後一個具有角色的主體存取權,請刪除該角色的 bindings
陣列。政策中不得有空白 bindings
陣列。
修改政策以授予適用的角色後,請執行 gcloud projects set-iam-policy
指令來進行變更。指定專案和您建立的政策檔案路徑。
gcloud projects set-iam-policy PROJECT_STORE_ID \ POLICY_FILE_NAME
如果要求成功,系統會顯示專案名稱和繫結。
Updated IAM policy for project [PROJECT_ID]. bindings: - members: - serviceAccount:service-account-13@appspot.gserviceaccount.com - serviceAccount:NEW_USER_EMAIL_ADDRESS role: roles/healthcare.nlpServiceViewer etag: bytes version: VERSION_NUMBER
curl
透過程式或使用文字編輯器修改擷取的政策,以授予或撤銷使用者的角色。政策變更時,etag
值也會變更,因此您必須指定目前的值。
如要將角色授予新服務帳戶,請將服務帳戶的電子郵件地址新增至 roles/healthcare.nlpServiceViewer
繫結下方的 members
陣列:
{ "role":"roles/healthcare.nlpServiceViewer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "serviceAccount:NEW_SERVICE_ACCOUNT_EMAIL_ADDRESS" ] }
members
陣列中刪除其電子郵件地址。如要撤銷最後一個具有角色的主體存取權,請刪除該角色的 bindings
陣列。政策中不得有空白 bindings
陣列。
修改政策以授予適用的角色後,請呼叫 projects.setIamPolicy
以進行更新。
如要設定專案層級的 IAM 政策,請提出 POST
要求,並指定專案名稱、政策和存取權權杖。
以下範例說明如何使用 curl
提出 POST
要求,將現有的 roles/healthcare.nlpServiceViewer
角色授予新使用者:
Policy
。
curl -X POST \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ --data "{ 'policy': { 'bindings': [ { 'role':'roles/healthcare.nlpServiceViewer', 'members': [ 'serviceAccount:service-account-13@appspot.gserviceaccount.com' ] } ] } }" "https://cloudresourcemanager.googleapis.com/v1/projects/PROJECT_ID:setIamPolicy"
回應如下:
{ "etag":"bytes", "bindings": [ { "role":"roles/healthcare.nlpServiceViewer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com" ] } ] }
PowerShell
透過程式或使用文字編輯器修改擷取的政策,以授予或撤銷使用者的角色。政策變更時,etag
值也會變更,因此您必須指定目前的值。
如要將角色授予新服務帳戶,請將服務帳戶的電子郵件地址新增至 roles/healthcare.nlpServiceViewer
繫結下方的 members
陣列:
{ "role":"roles/healthcare.nlpServiceViewer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "serviceAccount:NEW_SERVICE_ACCOUNT_EMAIL_ADDRESS" ] }
members
陣列中刪除其電子郵件地址。如要撤銷最後一個具有角色的主體存取權,請刪除該角色的 bindings
陣列。政策中不得有空白 bindings
陣列。
修改政策以授予適用的角色後,請呼叫 projects.setIamPolicy
以進行更新。
如要設定專案層級的 IAM 政策,請提出 POST
要求,並指定專案名稱、政策和存取權權杖。
以下範例說明如何使用 curl
提出 POST
要求,將現有的 roles/healthcare.nlpServiceViewer
角色授予新使用者:
Policy
。
$cred = gcloud auth application-default print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Post ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -Body "{ 'policy': { 'bindings': [ { 'role': 'roles/healthcare.nlpServiceViewer', 'members': [ 'serviceAccount:service-account-13@appspot.gserviceaccount.com', 'serviceAccount:NEW_USER_EMAIL_ADDRESS' ] } ] } }" ` -Uri "https://cloudresourcemanager.googleapis.com/v1/projects/PROJECT_ID:setIamPolicy" | Select-Object -Expand Content
回應如下:
{ "etag":"bytes", "bindings": [ { "role":"roles/healthcare.nlpServiceViewer", "members": [ "serviceAccount:service-account-13@appspot.gserviceaccount.com", "serviceAccount:NEW_USER_EMAIL_ADDRESS" ] } ] }