または AWS SDK DeleteBucketLifecycleで使用する CLI - AWS SDK コード例

AWS Doc SDK Examples GitHub リポジトリには他にも AWS SDK例があります。

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

または AWS SDK DeleteBucketLifecycleで使用する 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 詳細については、 リファレンスDeleteBucketLifecycleの「」を参照してください。 AWS SDK for .NET API

CLI
AWS CLI

次のコマンドは、my-bucket という名前のバケットからライフサイクル設定を削除します。

aws s3api delete-bucket-lifecycle --bucket my-bucket
  • API 詳細については、AWS CLI 「 コマンドリファレンスDeleteBucketLifecycle」の「」を参照してください。

Python
SDK Python 用 (Boto3)
注記

の詳細については、「」を参照してください 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 詳細については、DeleteBucketLifecycleAWS SDK「 Python (Boto3) APIリファレンス」の「」を参照してください。