本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
搭DeleteBucketLifecycle
配 AWS SDK或使用 CLI
下列程式碼範例會示範如何使用DeleteBucketLifecycle
。
- .NET
-
- AWS SDK for .NET
-
注意
還有更多關於 GitHub。尋找完整範例,並了解如何在 AWS 程式碼範例儲存庫
中設定和執行。 /// <summary> /// This method removes the Lifecycle configuration from the named /// S3 bucket. /// </summary> /// <param name="client">The S3 client object used to call /// the RemoveLifecycleConfigAsync method.</param> /// <param name="bucketName">A string representing the name of the /// S3 bucket from which the configuration will be removed.</param> public static async Task RemoveLifecycleConfigAsync(IAmazonS3 client, string bucketName) { var request = new DeleteLifecycleConfigurationRequest() { BucketName = bucketName, }; await client.DeleteLifecycleConfigurationAsync(request); }
-
如需詳API細資訊,請參閱AWS SDK for .NET API參考DeleteBucketLifecycle中的。
-
- CLI
-
- AWS CLI
-
下列指令會從名為的值區刪除生命週期組態
my-bucket
:aws s3api delete-bucket-lifecycle --bucket
my-bucket
-
如需詳API細資訊,請參閱AWS CLI 指令參考DeleteBucketLifecycle
中的。
-
- Python
-
- SDK對於 Python(肉毒桿菌 3)
-
注意
還有更多關於 GitHub。尋找完整範例,並了解如何在 AWS 程式碼範例儲存庫
中設定和執行。 class BucketWrapper: """Encapsulates S3 bucket actions.""" def __init__(self, bucket): """ :param bucket: A Boto3 Bucket resource. This is a high-level resource in Boto3 that wraps bucket actions in a class-like structure. """ self.bucket = bucket self.name = bucket.name def delete_lifecycle_configuration(self): """ Remove the lifecycle configuration from the specified bucket. """ try: self.bucket.LifecycleConfiguration().delete() logger.info( "Deleted lifecycle configuration for bucket '%s'.", self.bucket.name ) except ClientError: logger.exception( "Couldn't delete lifecycle configuration for bucket '%s'.", self.bucket.name, ) raise
-
如需詳API細資訊,請參閱DeleteBucketLifecycle中AWS SDK的《Python (博多 3) API 參考》。
-
如需 AWS SDK開發人員指南和程式碼範例的完整清單,請參閱搭配 AWS SDK 使用此服務。本主題也包含有關入門的資訊以及舊SDK版的詳細資訊。
DeleteBucketInventoryConfiguration
DeleteBucketMetricsConfiguration