必要的角色
如要取得設定及管理 Storage Intelligence 所需的權限,請要求管理員授予您專案、資料夾或機構的儲存空間管理員 (roles/storage.admin
) IAM 角色。如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和機構的存取權」。
這個預先定義的角色具備設定及管理 Storage Intelligence 所需的權限。如要查看確切的必要權限,請展開「必要權限」部分:
所需權限
如要設定及管理 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 名稱篩選」。
按一下「啟用這項設定」。
指令列
-
In the Google Cloud console, activate Cloud Shell.
At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.
如要設定 Storage Intelligence,請使用
gcloud alpha storage intelligence-configs enable
指令搭配下列其中一個旗標:--project
:為專案設定 Storage Intelligence。這個值是專案 ID。例如:my-project
。--sub-folder
:為資料夾設定儲存空間智慧功能。值為資料夾 ID。例如:1234567890
。--organization
:為機構設定儲存空間智慧功能。這個值是機構 ID。例如:9876546738
。舉例來說,下列指令會為名為
my-project
的專案設定 Storage Intelligence:gcloud alpha storage intelligence-configs enable --project=PROJECT_ID
其中 PROJECT_ID 是專案 ID。
如要在 Storage Intelligence 設定中納入或排除特定值區,請使用下列任一標記:
--exclude-bucket-regexes
:要從 Storage Intelligence 設定中排除的值區 ID 正則運算式清單。--include-bucket-regexes
:要納入 Storage Intelligence 設定的值區 ID 正則運算式清單。
舉例來說,如要排除名稱包含 colddata 的所有值區,請使用下列指令:
gcloud alpha storage intelligence-configs enable --organization=54343 --exclude-bucket-regexes=colddata.*
舉例來說,如要排除名為「colddata」的值區,請使用下列指令:
gcloud alpha storage intelligence-configs enable --organization=54343 --exclude-bucket-regexes=colddata
舉例來說,如要排除名為「colour」或「color」的值區,請使用下列指令:
gcloud alpha storage intelligence-configs enable --organization=my-org --exclude-bucket-regexes=colou?r
如要根據 bucket 的位置納入或排除 bucket,請在 Storage Intelligence 設定中使用任何下列標記:
--exclude-locations
:要從 Storage Intelligence 設定中排除的位置清單。--include-locations
:要納入儲存空間智慧設定的位置清單。
例如:
gcloud alpha storage intelligence-configs enable --sub-folder=123456 --include-locations=us-east1,us-west1
REST API
JSON API
安裝並初始化 gcloud CLI,以便為
Authorization
標頭產生存取權杖。建立 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-project
FOLDER_ID
是 Google Cloud 資料夾 ID。資料夾 ID 為數字,例如123456789012
ORGANIZATION_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-project
UPDATE_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 為數字,例如123456789012
UPDATE_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 為數字,例如79293024087
UPDATE_MASK
是以半形逗號分隔的欄位名稱清單,這項要求會更新這些欄位。這些欄位採用 FieldMask 格式,且屬於IntelligenceConfig
資源。
查看 Storage Intelligence 設定
控制台
前往 Google Cloud 控制台的「Storage Intelligence Configuration」(儲存空間智慧設定) 頁面。
選取頁面頂端的專案挑選器。
在「選取資源」對話方塊中,選取要查看 Storage Intelligence 設定的資源。
如果資源已設定 Storage Intelligence,則「狀態」欄位會顯示 Enabled
。如果資源未設定 Storage Intelligence,系統會顯示「設定 Storage Intelligence」按鈕。
指令列
-
In the Google Cloud console, activate Cloud Shell.
At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.
如要查看資源的 Storage Intelligence 設定,請使用
gcloud alpha storage intelligence-configs describe
指令搭配下列其中一個旗標:--project
:查看專案的 Storage Intelligence 設定。這個值是專案 ID。例如:my-project
。--sub-folder
:查看資料夾的儲存空間智慧功能設定。值為資料夾 ID。例如:1234567890
。--organization
:查看機構的儲存空間智慧功能設定。這個值是機構 ID。例如:9876546738
。舉例來說,下列指令會查看名為
my-project
的專案的 Storage Intelligence 設定:gcloud alpha storage intelligence-configs describe --project=PROJECT_ID
其中 PROJECT_ID 是 Google Cloud 專案 ID。專案 ID 為英數字元,例如
my-project
。
REST API
JSON API
安裝並初始化 gcloud CLI,以便為
Authorization
標頭產生存取權杖。如要查看資源的 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 設定
控制台
指令列
-
In the Google Cloud console, activate Cloud Shell.
At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.
如要更新資源的 Storage Intelligence 設定,請使用
gcloud alpha 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 alpha storage intelligence-configs update --project=PROJECT_ID
其中 PROJECT_ID 是 Google Cloud 專案 ID。專案 ID 為英數字元,例如
my-project
。
REST API
JSON API
安裝並初始化 gcloud CLI,以便為
Authorization
標頭產生存取權杖。建立 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-project
FOLDER_ID
是 Google Cloud 資料夾 ID。資料夾 ID 為數字,例如123456789012
ORGANIZATION_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 設定
使用
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-project
UPDATE_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 為數字,例如123456789012
UPDATE_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 為數字,例如79293024087
UPDATE_MASK
是以半形逗號分隔的欄位名稱清單,這項要求會更新這些欄位。這些欄位採用 FieldMask 格式,且屬於IntelligenceConfig
資源。
停用 Storage Intelligence
控制台
前往 Google Cloud 控制台的「Storage Intelligence Configuration」(儲存空間智慧設定) 頁面。
選取頁面頂端的專案挑選器。
在「選取資源」對話方塊中,選取要停用 Storage Intelligence 的資源。
在「總覽」部分,按一下「狀態」欄位旁的「已啟用」。
在顯示的對話方塊中輸入「停用」,然後按一下「停用」。
指令列
-
In the Google Cloud console, activate Cloud Shell.
At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.
如要停用資源的 Storage Intelligence 設定,請使用
gcloud alpha 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 alpha storage intelligence-configs disable --project=PROJECT_ID
其中 PROJECT_ID 是 Google Cloud 專案 ID。專案 ID 為英數字元,例如
my-project
。
REST API
JSON API
安裝並初始化 gcloud CLI,以便為
Authorization
標頭產生存取權杖。下列各節將詳細說明如何停用資源的儲存空間智慧功能。
停用專案的 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 遷移。