下表列出執行 gcloud storage
指令時所需的 Identity and Access Management (IAM) 權限。IAM 權限會組合成角色。您可以為主體授予角色。
如需使用萬用字元、旗標 --recursive
和旗標 --billing-project
的注意事項,請參閱表格下方的章節。
指令 | 旗標 | 必要的 IAM 權限 |
---|---|---|
batch-operations jobs create |
storagebatchoperations.jobs.create |
|
batch-operations jobs cancel |
storagebatchoperations.jobs.cancel |
|
batch-operations jobs delete |
storagebatchoperations.jobs.delete |
|
batch-operations jobs get |
storagebatchoperations.jobs.get |
|
batch-operations jobs list |
storagebatchoperations.jobs.list |
|
buckets add-iam-policy-binding |
storage.buckets.get storage.buckets.getIamPolicy storage.buckets.setIamPolicy storage.buckets.update |
|
buckets create |
storage.buckets.create
storage.buckets.setIpFilter 15 |
|
buckets delete |
storage.buckets.delete |
|
buckets describe |
storage.buckets.get storage.buckets.getIamPolicy 1storage.buckets.getIpFilter 16 |
|
buckets get-iam-policy |
storage.buckets.get storage.buckets.getIamPolicy |
|
buckets list |
storage.buckets.list storage.buckets.getIamPolicy 1 |
|
buckets notifications create |
storage.buckets.get storage.buckets.update pubsub.topics.get (用於包含 Pub/Sub 主題的專案)pubsub.topics.create 3 (用於包含 Pub/Sub 主題的專案)pubsub.topics.getIamPolicy (用於接收通知的 Pub/Sub 主題)pubsub.topics.setIamPolicy 3 (用於接收通知的 Pub/Sub 主題) |
|
buckets notifications create |
--skip-topic-setup |
storage.buckets.get storage.buckets.update |
buckets notifications delete |
storage.buckets.get storage.buckets.update |
|
buckets notifications describe |
storage.buckets.get |
|
buckets notifications list |
storage.buckets.get |
|
buckets relocate |
storage.buckets.relocate |
|
buckets remove-iam-policy-binding |
storage.buckets.get storage.buckets.getIamPolicy storage.buckets.setIamPolicy storage.buckets.update |
|
buckets set-iam-policy |
storage.buckets.setIamPolicy storage.buckets.update |
|
buckets update |
storage.buckets.update storage.buckets.setIpFilter 15 |
|
buckets update |
--no-requester-pays |
storage.buckets.update resourcemanager.projects.createBillingAssignment 2 |
buckets update |
--recovery-point-objective --rpo --[no-]uniform-bucket-level-access |
storage.buckets.get storage.buckets.update |
buckets update |
--clear-pap --clear-public-access-prevention --[no-]pap --[no-]public-access-prevention |
storage.buckets.get storage.buckets.update storage.buckets.setIamPolicy |
cat |
storage.objects.get storage.objects.list 13 |
|
cp |
storage.objects.get storage.buckets.get 12storage.objects.list 4 (用於目的地值區)
storage.objects.create storage.objects.delete 5 |
|
du |
storage.objects.list |
|
folders create |
storage.folders.create |
|
folders delete |
storage.folders.delete |
|
folders describe |
storage.folders.get |
|
folders list |
storage.folders.list |
|
folders rename |
storage.folders.rename storage.folders.create |
|
hash |
storage.objects.get |
|
hmac create |
storage.hmacKeys.create |
|
hmac delete |
storage.hmacKeys.delete |
|
hmac describe |
storage.hmacKeys.get |
|
hmac list |
storage.hmacKeys.list |
|
hmac update |
storage.hmacKeys.update |
|
insights dataset-configs create |
storageinsights.datasetConfigs.create |
|
insights dataset-configs create-link |
storageinsights.datasetConfigs.linkDataset |
|
insights dataset-configs delete |
storageinsights.datasetConfigs.delete |
|
insights dataset-configs delete-link |
storageinsights.datasetConfigs.unlinkDataset |
|
insights dataset-configs describe |
storageinsights.datasetConfigs.get |
|
insights dataset-configs list |
storageinsights.datasetConfigs.list |
|
insights dataset-configs update |
storageinsights.datasetConfigs.update |
|
insights inventory-reports create |
storageinsights.reportConfigs.create |
|
insights inventory-reports delete |
storageinsights.reportConfigs.delete |
|
insights inventory-reports details list |
storageinsights.reportDetails.list |
|
insights inventory-reports details describe |
storageinsights.reportDetails.get |
|
insights inventory-reports list |
storageinsights.reportConfigs.list |
|
insights inventory-reports update |
storageinsights.reportConfigs.get storageinsights.reportConfigs.update |
|
ls (用於值區清單) |
storage.buckets.list storage.buckets.getIamPolicy 6 |
|
ls (用於物件資訊) |
storage.objects.get 7storage.objects.list storage.objects.getIamPolicy 8 |
|
ls |
--buckets |
storage.buckets.get storage.buckets.getIamPolicy 6 |
storage intelligence-config enable |
storage.intelligenceConfigs.update |
|
storage-intelligence disable |
storage.intelligenceConfigs.update |
|
storage-intelligence describe |
storage.intelligenceConfigs.get |
|
storage-intelligence update |
storage.intelligenceConfigs.update |
|
mv |
storage.objects.list 4 (用於目的地值區)storage.objects.get (用於來源物件)storage.objects.create (用於目的地值區)storage.objects.delete (用於來源值區)storage.objects.delete 5 (用於目的地值區) |
|
objects compose |
storage.objects.get storage.objects.create storage.objects.delete 9 |
|
objects describe |
storage.objects.get storage.objects.getIamPolicy 8 |
|
objects list |
storage.objects.list storage.objects.getIamPolicy 8 |
|
objects update |
storage.objects.get storage.objects.list storage.objects.update |
|
objects update |
--storage-class --encryption-key --clear-encryption-key |
storage.objects.get storage.objects.list storage.objects.create storage.objects.delete |
objects update |
--retention-mode --retain-until --clear-retention |
storage.objects.get storage.objects.list storage.objects.update storage.objects.setRetention storage.objects.overrideUnlockedRetention 11 |
operations cancel |
storage.bucketOperations.cancel |
|
operations describe |
storage.bucketOperations.get |
|
operations list |
storage.bucketOperations.list |
|
restore |
storage.objects.create storage.objects.delete 9storage.objects.restore |
|
restore |
--async |
storage.objects.create storage.objects.delete 14storage.objects.restore storage.buckets.restore |
rm |
storage.buckets.delete storage.objects.delete storage.objects.list |
|
rsync |
storage.objects.get storage.objects.create storage.objects.delete 10storage.objects.list |
|
rsync |
--dry-run |
storage.objects.list (用於來源和目的地值區) |
service-agent |
resourceManager.projects.get |
|
sign-url |
無;不過,使用金鑰做為此指令一部分的服務帳戶必須具備執行要求的權限,才能將要求編碼至已簽署的網址。 |
1只有在您要將 IAM 政策列入詳細資料中時,才需要這項權限。
2只有在您的要求中未包含計費專案時,才需要這項權限。詳情請參閱要求者付費的使用及存取需求一節。
3如果主題已存在且相關服務帳戶可存取該主題,則不需要這些權限。
4只有在指令中的目標位置包含物件路徑時,才需要這項權限。
5只有在使用平行複合上傳,或是未使用 --no-clobber
旗標,但插入的物件名稱與值區中現有物件名稱相同時,才需要這項權限。
6只有在您要將 IAM 政策列入詳細資料中時,才需要這項權限。
7只有在使用 --fetch-encrypted-object-hashes
旗標時,才需要這項權限。
8只有在您要將 IAM 政策列入詳細資料中時,才需要這項權限。這項權限不適用於已啟用統一值區層級存取權的值區。
9只有在作業建立的物件名稱與值區中現有物件名稱相同時,才需要這項權限。
10只有在您使用 --delete-unmatched-destination-objects
旗標,或是插入的物件名稱與值區中現有物件名稱相同時,才需要這項權限,且該物件的資料也不同。
11只有在要求中也需要使用 --override-unlocked-retention
旗標時,才需要這項權限。
12如果 gcloud CLI 屬性 storage/parallel_composite_upload_compatibility_check
設為 True
,就必須具備這項權限,才能執行平行複合式上傳。
13只有在您要使用規則運算式擷取物件時,才需要這項權限。
14只有在要求包含 --allow-overwrite
標記,且作業建立的物件名稱與值區中現有物件名稱相同時,才需要這項權限。
15只有在要求中包含旗標 --ip-filter-file
時,才需要這項權限,才能在儲存桶中建立、更新或刪除 IP 篩選規則。
16只有在您要將儲存桶的 IP 篩選器設定納入回應時,才需要這項權限。
--billing-project
頂層旗標
如果您使用 --billing-project
全域標記來指定因要求需要付費的專案,就必須擁有指定專案的 serviceusage.services.use
權限。舉例來說,存取已啟用要求者付費功能的值區時,就會使用旗標 --billing-project
。
萬用字元與遞迴標記
如果您使用 URI 萬用字元在指令中選取多個物件,就必須擁有物件所在值區的 storage.objects.list
權限。同樣地,如果您使用 URI 萬用字元在指令中選取多個值區,就必須擁有值區所在專案的 storage.buckets.list
權限。
如果您使用 --recursive
旗標,除了使用特定指令的必要權限之外,還必須具備相關值區的 storage.objects.list
權限。
後續步驟
- 在專案和值區層級授予 IAM 角色。
- 查看含有 Cloud Storage 權限的 IAM 角色。