将 DeleteBucketLifecycle 与 Amazon SDK 或 CLI 配合使用
以下代码示例演示如何使用 DeleteBucketLifecycle。
- .NET
-
- Amazon SDK for .NET
-
注意
查看 GitHub,了解更多信息。在 Amazon 代码示例存储库
中查找完整示例,了解如何进行设置和运行。 /// <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 详细信息,请参阅《Amazon SDK for .NET API Reference》中的 DeleteBucketLifecycle。
-
- CLI
-
- Amazon CLI
-
以下命令从名为
amzn-s3-demo-bucket的存储桶中删除生命周期配置:aws s3api delete-bucket-lifecycle --bucketamzn-s3-demo-bucket-
有关 API 详细信息,请参阅《Amazon CLI 命令参考》中的 DeleteBucketLifecycle
。
-
- Python
-
- 适用于 Python 的 SDK(Boto3)
-
注意
查看 GitHub,了解更多信息。在 Amazon 代码示例存储库
中查找完整示例,了解如何进行设置和运行。 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 详细信息,请参阅《Amazon SDK for Python (Boto3) API Reference》中的 DeleteBucketLifecycle。
-
- SAP ABAP
-
- 适用于 SAP ABAP 的 SDK
-
注意
查看 GitHub,了解更多信息。在 Amazon 代码示例存储库
中查找完整示例,了解如何进行设置和运行。 TRY. lo_s3->deletebucketlifecycle( iv_bucket = iv_bucket_name ). MESSAGE 'Bucket lifecycle configuration deleted.' TYPE 'I'. CATCH /aws1/cx_s3_nosuchbucket. MESSAGE 'Bucket does not exist.' TYPE 'E'. ENDTRY.-
有关 API 详细信息,请参阅《Amazon SDK for SAP ABAP API Reference》中的 DeleteBucketLifecycle。
-
有关 Amazon SDK 开发人员指南和代码示例的完整列表,请参阅 使用 Amazon SDK 通过 Amazon S3 进行开发。本主题还包括有关入门的信息以及有关先前的 SDK 版本的详细信息。
DeleteBucketInventoryConfiguration
DeleteBucketMetricsConfiguration