View a markdown version of this page

搭配使用 DeleteObjectTagging 與 CLI - AWS SDK 程式碼範例

文件 AWS 開發套件範例 GitHub 儲存庫中有更多可用的 AWS SDK 範例

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

搭配使用 DeleteObjectTagging 與 CLI

下列程式碼範例示範如何使用 DeleteObjectTagging

CLI
AWS CLI

刪除物件的標籤集

下列 delete-object-tagging 範例會從物件 doc1.rtf 刪除具有指定索引鍵的標籤。

aws s3api delete-object-tagging \ --bucket amzn-s3-demo-bucket \ --key doc1.rtf

此命令不會產生輸出。

PowerShell
Tools for PowerShell V4

範例 1:此命令會移除與給定 S3 儲存貯體中具索引鍵 'testfile.txt' 之物件相關聯的所有標籤。

Remove-S3ObjectTagSet -Key 'testfile.txt' -BucketName 'amzn-s3-demo-bucket' -Select '^Key'

輸出:

Confirm Are you sure you want to perform this action? Performing the operation "Remove-S3ObjectTagSet (DeleteObjectTagging)" on target "testfile.txt". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y testfile.txt
  • 如需 API 詳細資訊,請參閱《AWS Tools for PowerShell Cmdlet 參考 (V4)》中的 DeleteObjectTagging

Tools for PowerShell V5

範例 1:此命令會移除與給定 S3 儲存貯體中具索引鍵 'testfile.txt' 之物件相關聯的所有標籤。

Remove-S3ObjectTagSet -Key 'testfile.txt' -BucketName 'amzn-s3-demo-bucket' -Select '^Key'

輸出:

Confirm Are you sure you want to perform this action? Performing the operation "Remove-S3ObjectTagSet (DeleteObjectTagging)" on target "testfile.txt". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y testfile.txt
  • 如需 API 詳細資訊,請參閱《AWS Tools for PowerShell Cmdlet 參考 (V5)》中的 DeleteObjectTagging