本頁說明如何為資源設定、查看、更新及停用Storage Intelligence。
必要的角色
如要取得設定及管理 Storage Intelligence 所需的權限,請要求系統管理員在專案、資料夾或機構中,授予您「Storage 管理員」 (roles/storage.admin) IAM 角色。如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和組織的存取權」。
這個預先定義的角色具備設定及管理 Storage Intelligence 所需的權限。如要查看確切的必要權限,請展開「Required permissions」(必要權限) 部分:
所需權限
如要設定及管理 Storage Intelligence,您必須具備下列權限:
-
設定 Storage Intelligence:
storage.intelligenceConfigs.update -
查看 Storage Intelligence 設定:
storage.intelligenceConfigs.get -
更新 Storage Intelligence 設定:
storage.intelligenceConfigs.update -
停用 Storage Intelligence:
storage.intelligenceConfigs.update
設定 Storage Intelligence
控制台
前往 Google Cloud 控制台的「Storage Intelligence Configuration」(儲存空間智慧設定) 頁面。
按一下「啟用 Storage Intelligence」。
在「設定 Storage Intelligence」對話方塊中,選取要設定 Storage Intelligence 的資源。
按一下「繼續」。
選用步驟:如要在 Storage Intelligence 設定中納入或排除特定 bucket,請按照下列步驟操作:
如要從特定位置選取值區,請使用「篩選器類型」選單。如要納入或排除 bucket,請從「位置」選單中選取位置。詳情請參閱「依位置篩選」。
如要依名稱選取 Cloud Storage bucket,請使用「篩選器類型」選單。如要加入或排除 bucket,請指定 bucket 名稱的規則運算式,然後按一下「新增規則運算式」。詳情請參閱「依 bucket 名稱篩選」。
按一下「啟用這項設定」。
指令列
-
在 Google Cloud 控制台中啟用 Cloud Shell。
Google Cloud 主控台底部會開啟一個 Cloud Shell 工作階段,並顯示指令列提示。Cloud Shell 是已安裝 Google Cloud CLI 的殼層環境,並已針對您目前的專案設定好相關值。工作階段可能要幾秒鐘的時間才能初始化。
如要設定 Storage Intelligence,請使用
gcloud storage intelligence-configs enable指令搭配下列其中一個旗標:--project:為專案設定 Storage Intelligence。這個值是專案 ID。例如:my-project。--sub-folder:為資料夾設定 Storage Intelligence。值為資料夾 ID。例如:1234567890。--organization:為機構設定 Storage Intelligence。這個值是機構 ID。例如:9876546738。舉例來說,下列指令會為名為
my-project的專案設定 Storage Intelligence:gcloud storage intelligence-configs enable --project=PROJECT_ID
其中 PROJECT_ID 是專案 ID。
如要在 Storage Intelligence 設定中納入或排除特定值區,請使用下列任一標記:
--exclude-bucket-regexes:要從 Storage Intelligence 設定中排除的 bucket ID 規則運算式清單。--include-bucket-regexes:要納入 Storage Intelligence 設定的 bucket ID 正則運算式清單。
舉例來說,如要排除名稱中含有「colddata」的所有值區,請使用下列指令:
gcloud storage intelligence-configs enable --organization=54343 --exclude-bucket-regexes=colddata.*
舉例來說,如要排除名為「colddata」的值區,請使用下列指令:
gcloud storage intelligence-configs enable --organization=54343 --exclude-bucket-regexes=colddata
舉例來說,如要排除名為「colour」或「color」的 bucket,請使用下列指令:
gcloud storage intelligence-configs enable --organization=my-org --exclude-bucket-regexes=colou?r
如要根據 bucket 的位置納入或排除 bucket,請在 Storage Intelligence 設定中使用下列任一標記:
--exclude-locations:要從 Storage Intelligence 設定中排除的位置清單。--include-locations:要納入 Storage Intelligence 設定的位置清單。
例如:
gcloud storage intelligence-configs enable --sub-folder=123456 --include-locations=us-east1,us-west1
REST API
JSON API
建立包含下列詳細資料的 JSON 檔案:
name:Storage Intelligence 設定的名稱。請使用下列任一格式:- 專案:
projects/PROJECT_ID/locations/global/intelligenceConfig - 資料夾:
folders/FOLDER_ID/locations/global/intelligenceConfig - 機構:
organizations/ORGANIZATION_ID/locations/global/intelligenceConfig
其中:
PROJECT_ID是 Google Cloud 專案 ID。專案 ID 為英數字元,例如my-projectFOLDER_ID是 Google Cloud 資料夾 ID。資料夾 ID 為數字,例如123456789012ORGANIZATION_ID是 Google Cloud 機構 ID。機構 ID 為數字,例如123456789012
- 專案:
- 設定
editionConfig欄位。詳情請參閱 版本設定。 - 選用:設定
filter物件。您可以根據 Cloud Storage 位置和bucket ID 規則運算式,加入或排除 bucket。
{ "name":"projects/PROJECT_ID/locations/global/intelligenceConfig", "editionConfig":"EDITION_CONFIGURATION", "filter":{ "includedCloudStorageBuckets":{ "bucketIdRegexes":[ "INCLUDED_BUCKET_ID_REGEX", ...] }, "excludedCloudStorageBuckets":{ "bucketIdRegexes":[ "EXCLUDED_BUCKET_ID_REGEX", ...] }, "includedCloudStorageLocations":{ "locations":[ "INCLUDED_BUCKET_LOCATION", ...] }, "excludedCloudStorageLocations":{ "locations":[ "EXCLUDED_BUCKET_LOCATION", ...] } } }
其中:
PROJECT_ID是 Google Cloud 專案 ID。專案 ID 為英數字元,例如my-project。EDITION_CONFIGURATION是 Storage Intelligence 版本設定。- 選用:
INCLUDED_BUCKET_ID_REGEX是規則運算式,用於指定要納入哪些 bucket ID。您可以將一或多個規則運算式指定為清單。 - 選用:
EXCLUDED_BUCKET_ID_REGEX是規則運算式,用於指定要排除的 bucket ID。您可以將一或多個規則運算式指定為清單。 - 選用:
INCLUDED_BUCKET_LOCATION是您要在 Storage Intelligence 設定中納入 bucket 的位置。您可以將一或多個位置指定為清單。 - 選用:
EXCLUDED_BUCKET_LOCATION是要從 Storage Intelligence 設定中排除 bucket 的位置。您可以將一或多個位置指定為清單。
以下各節說明如何使用 REST API,為專案、資料夾或機構設定 Storage Intelligence。您也可以使用 REST API 設定 Storage Intelligence 30 天入門試用方案。使用下列任一方法,設定 Storage Intelligence 或 Storage Intelligence 30 天入門試用方案。
為專案設定 Storage Intelligence
使用
cURL呼叫 JSON API,要求為專案設定 Storage Intelligence。curl -X POST \ --data-binary @JSON_FILE_NAME \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ "https://storage.googleapis.com/v2/projects/PROJECT_ID/locations/global/intelligenceConfig?updateMask=UPDATE_MASK"其中:
PROJECT_ID是 Google Cloud 專案 ID。專案 ID 為英數字元,例如my-projectUPDATE_MASK是以逗號分隔的欄位名稱清單,代表這項要求更新的欄位。這些欄位採用 FieldMask 格式,且屬於IntelligenceConfig資源。
為資料夾設定 Storage Intelligence
使用
cURL呼叫 JSON API,要求為資料夾設定 Storage Intelligence 功能。curl -X POST \ --data-binary @JSON_FILE_NAME \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ "https://storage.googleapis.com/v2/folders/FOLDER_ID/locations/global/intelligenceConfig?updateMask=UPDATE_MASK"其中:
FOLDER_ID是 Google Cloud 資料夾 ID。資料夾 ID 為數字,例如123456789012UPDATE_MASK是以逗號分隔的欄位名稱清單,代表這項要求更新的欄位。這些欄位採用 FieldMask 格式,且屬於IntelligenceConfig資源。
為機構設定 Storage Intelligence
使用
cURL呼叫 JSON API,並要求為機構設定 Storage Intelligence。curl -X POST \ --data-binary @JSON_FILE_NAME \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ "https://storage.googleapis.com/v2/organizations/ORGANIZATION_ID/locations/global/intelligenceConfig?updateMask=UPDATE_MASK"
其中:
ORGANIZATION_ID是 Google Cloud 機構 ID。機構 ID 為數字,例如79293024087UPDATE_MASK是以逗號分隔的欄位名稱清單,代表這項要求更新的欄位。這些欄位採用 FieldMask 格式,且屬於IntelligenceConfig資源。
查看 Storage Intelligence 設定
控制台
前往 Google Cloud 控制台的「Storage Intelligence Configuration」(儲存空間智慧設定) 頁面。
選取頁面頂端的專案挑選器。
在「選取資源」對話方塊中,選取要查看 Storage Intelligence 設定的資源。
如果資源已設定 Storage Intelligence,則「狀態」欄位會顯示 Enabled。如果資源未設定 Storage Intelligence,系統會顯示「設定 Storage Intelligence」按鈕。
指令列
-
在 Google Cloud 控制台中啟用 Cloud Shell。
Google Cloud 主控台底部會開啟一個 Cloud Shell 工作階段,並顯示指令列提示。Cloud Shell 是已安裝 Google Cloud CLI 的殼層環境,並已針對您目前的專案設定好相關值。工作階段可能要幾秒鐘的時間才能初始化。
如要查看資源的 Storage Intelligence 設定,請使用
gcloud storage intelligence-configs describe指令搭配下列其中一個旗標:--project:查看專案的 Storage Intelligence 設定。這個值是專案 ID。例如:my-project。--sub-folder:查看資料夾的 Storage Intelligence 設定。值為資料夾 ID。例如:1234567890。--organization:查看機構的 Storage Intelligence 設定。這個值是機構 ID。例如:9876546738。舉例來說,下列指令會查看名為
my-project的專案的 Storage Intelligence 設定:gcloud storage intelligence-configs describe --project=PROJECT_ID
其中 PROJECT_ID 是 Google Cloud 專案 ID。專案 ID 為英數字元,例如
my-project。
REST API
JSON API
如要查看資源的 Storage Intelligence 設定,請參閱下列各節。
查看專案的 Storage Intelligence 設定
使用
cURL呼叫 JSON API,並傳送要求查看專案的 Storage Intelligence 設定。curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://storage.googleapis.com/v2/projects/PROJECT_ID/locations/global/intelligenceConfig"其中:
PROJECT_ID是 Google Cloud 專案 ID。專案 ID 為英數字元,例如my-project。查看資料夾的 Storage Intelligence 設定
使用
cURL呼叫 JSON API,要求查看資料夾的 Storage Intelligence 設定。curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://storage.googleapis.com/v2/folders/FOLDER_ID/locations/global/intelligenceConfig"其中:
FOLDER_ID是 Google Cloud 資料夾 ID。資料夾 ID 為數字,例如123456789012。查看機構的 Storage Intelligence 設定
使用
cURL呼叫 JSON API,要求查看機構的 Storage Intelligence 設定。curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://storage.googleapis.com/v2/organizations/ORGANIZATION_ID/locations/global/intelligenceConfig"其中:
ORGANIZATION_ID是 Google Cloud 機構 ID。機構 ID 為數字,例如79293024087。
更新 Storage Intelligence 設定
控制台
指令列
-
在 Google Cloud 控制台中啟用 Cloud Shell。
Google Cloud 主控台底部會開啟一個 Cloud Shell 工作階段,並顯示指令列提示。Cloud Shell 是已安裝 Google Cloud CLI 的殼層環境,並已針對您目前的專案設定好相關值。工作階段可能要幾秒鐘的時間才能初始化。
如要更新資源的 Storage Intelligence 設定,請使用
gcloud storage intelligence-configs update指令,並加上下列其中一個旗標:--project:更新專案的 Storage Intelligence 設定。這個值是專案 ID。例如:my-project。--sub-folder:更新資料夾的 Storage Intelligence 設定。值為資料夾 ID。例如:1234567890。--organization:更新機構的 Storage Intelligence 設定。這個值是機構 ID。例如:9876546738。舉例來說,下列指令會更新名為
my-project的專案的 Storage Intelligence 設定:gcloud storage intelligence-configs update --project=PROJECT_ID
其中 PROJECT_ID 是 Google Cloud 專案 ID。專案 ID 為英數字元,例如
my-project。
REST API
JSON API
建立包含下列詳細資料的 JSON 檔案:
name:Storage Intelligence 設定的名稱。請使用下列任一格式:- 專案:
projects/PROJECT_ID/locations/global/intelligenceConfig - 資料夾:
folders/FOLDER_ID/locations/global/intelligenceConfig - 機構:
organizations/ORGANIZATION_ID/locations/global/intelligenceConfig
其中:
PROJECT_ID是 Google Cloud 專案 ID。專案 ID 為英數字元,例如my-projectFOLDER_ID是 Google Cloud 資料夾 ID。資料夾 ID 為數字,例如123456789012ORGANIZATION_ID是 Google Cloud 機構 ID。機構 ID 為數字,例如123456789012
- 專案:
- 設定
editionConfig欄位。詳情請參閱 版本設定。 - 選用:設定
filter物件。您可以根據 Cloud Storage 位置和bucket ID 規則運算式,加入或排除 bucket。
{ "name":"projects/PROJECT_ID/locations/global/intelligenceConfig", "editionConfig":"EDITION_CONFIGURATION", "filter":{ "includedCloudStorageBuckets":{ "bucketIdRegexes":[ "INCLUDED_BUCKET_ID_REGEX", ...] }, "excludedCloudStorageBuckets":{ "bucketIdRegexes":[ "EXCLUDED_BUCKET_ID_REGEX", ...] }, "includedCloudStorageLocations":{ "locations":[ "INCLUDED_BUCKET_LOCATION", ...] }, "excludedCloudStorageLocations":{ "locations":[ "EXCLUDED_BUCKET_LOCATION", ...] } } }
其中:
PROJECT_ID是 Google Cloud 專案 ID。專案 ID 為英數字元,例如my-project。EDITION_CONFIGURATION是 Storage Intelligence 版本設定。- 選用:
INCLUDED_BUCKET_ID_REGEX是規則運算式,用於指定要納入哪些 bucket ID。您可以將一或多個規則運算式指定為清單。 - 選用:
EXCLUDED_BUCKET_ID_REGEX是規則運算式,用於指定要排除的 bucket ID。您可以將一或多個規則運算式指定為清單。 - 選用:
INCLUDED_BUCKET_LOCATION是您要在 Storage Intelligence 設定中納入 bucket 的位置。您可以將一或多個位置指定為清單。 - 選用:
EXCLUDED_BUCKET_LOCATION是要從 Storage Intelligence 設定中排除 bucket 的位置。您可以將一或多個位置指定為清單。
下列各節說明如何更新專案、資料夾或組織的 Storage Intelligence 設定。請使用下列其中一種方法更新 Storage Intelligence 設定。
更新專案的 Storage Intelligence 設定
使用
cURL呼叫 JSON API,要求更新專案的 Storage Intelligence 設定。curl -X PATCH \ --data-binary @JSON_FILE_NAME \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ "https://storage.googleapis.com/v2/projects/PROJECT_ID/locations/global/intelligenceConfig?updateMask=UPDATE_MASK"
更新資料夾的 Storage Intelligence 設定
使用
cURL呼叫 JSON API,要求更新資料夾的 Storage Intelligence 設定。其中:
PROJECT_ID是 Google Cloud 專案 ID。專案 ID 為英數字元,例如my-projectUPDATE_MASK是以逗號分隔的欄位名稱清單,代表這項要求更新的欄位。這些欄位採用 FieldMask 格式,且屬於IntelligenceConfig資源。
curl -X PATCH \ --data-binary @JSON_FILE_NAME \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ "https://storage.googleapis.com/v2/folders/FOLDER_ID/locations/global/intelligenceConfig?updateMask=UPDATE_MASK"
其中:
FOLDER_ID是 Google Cloud 資料夾 ID。資料夾 ID 為數字,例如123456789012UPDATE_MASK是以逗號分隔的欄位名稱清單,代表這項要求更新的欄位。這些欄位採用 FieldMask 格式,且屬於IntelligenceConfig資源。
更新機構的 Storage Intelligence 設定
使用
cURL呼叫 JSON API,並傳送更新機構的 Storage Intelligence 設定要求。curl -X PATCH \ --data-binary @JSON_FILE_NAME \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ "https://storage.googleapis.com/v2/organizations/ORGANIZATION_ID/locations/global/intelligenceConfig?updateMask=UPDATE_MASK"
其中:
ORGANIZATION_ID是 Google Cloud 機構 ID。機構 ID 為數字,例如79293024087UPDATE_MASK是以逗號分隔的欄位名稱清單,代表這項要求更新的欄位。這些欄位採用 FieldMask 格式,且屬於IntelligenceConfig資源。
停用 Storage Intelligence
控制台
前往 Google Cloud 控制台的「Storage Intelligence Configuration」(儲存空間智慧設定) 頁面。
選取頁面頂端的專案挑選器。
在「選取資源」對話方塊中,選取要停用 Storage Intelligence 的資源。
在「總覽」部分,按一下「狀態」欄位旁的「已啟用」。
在顯示的對話方塊中輸入「停用」,然後按一下「停用」。
指令列
-
在 Google Cloud 控制台中啟用 Cloud Shell。
Google Cloud 主控台底部會開啟一個 Cloud Shell 工作階段,並顯示指令列提示。Cloud Shell 是已安裝 Google Cloud CLI 的殼層環境,並已針對您目前的專案設定好相關值。工作階段可能要幾秒鐘的時間才能初始化。
如要停用資源的 Storage Intelligence 設定,請使用
gcloud storage intelligence-configs disable指令搭配下列其中一個旗標:--project:為專案停用 Storage Intelligence 設定。這個值是專案 ID。例如:my-project。--sub-folder:停用資料夾的 Storage Intelligence 設定。值為資料夾 ID。例如:1234567890。--organization:為機構停用 Storage Intelligence 設定。這個值是機構 ID。例如:9876546738。舉例來說,下列指令會為名為
my-project的專案停用 Storage Intelligence 設定:gcloud storage intelligence-configs disable --project=PROJECT_ID
其中 PROJECT_ID 是 Google Cloud 專案 ID。專案 ID 為英數字元,例如
my-project。
REST API
JSON API
下列各節將詳細說明如何停用資源的 Storage Intelligence 功能。
停用專案的 Storage Intelligence
使用
cURL呼叫 JSON API,要求更新專案的 Storage Intelligence。curl -X PATCH \ -H "Content-Type: application/json" \ -d '{ "edition_config": "DISABLED" }' \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://storage.googleapis.com/v2/projects/PROJECT_ID/locations/global/intelligenceConfig?updateMask=edition_config"其中:
PROJECT_ID是 Google Cloud 專案 ID。專案 ID 為英數字元,例如my-project。為資料夾停用 Storage Intelligence
使用
cURL呼叫 JSON API,要求更新資料夾的 Storage Intelligence。curl -X PATCH \ -H "Content-Type: application/json" \ -d '{ "edition_config": "DISABLED" }' \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://storage.googleapis.com/v2/folders/FOLDER_ID/locations/global/intelligenceConfig?updateMask=edition_config"其中:
FOLDER_ID是 Google Cloud 資料夾 ID。資料夾 ID 為數字,例如123456789012。為機構停用 Storage Intelligence
使用
cURL呼叫 JSON API,要求為機構停用 Storage Intelligence。curl -X PATCH \ -H "Content-Type: application/json" \ -d '{ "edition_config": "DISABLED" }' \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://storage.googleapis.com/v2/organizations/ORGANIZATION_ID/locations/global/intelligenceConfig?updateMask=edition_config"其中:
ORGANIZATION_ID是 Google Cloud 機構 ID。機構 ID 為數字,例如79293024087。
後續步驟
- 瞭解儲存空間分析資料集。
- 瞭解如何在 Gemini 的協助下取得資料洞察。
- 瞭解商品目錄報表。
- 瞭解 bucket 遷移。