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

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

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

AWS SDK または CLI DeleteBucketLifecycleで を使用する

以下のコード例は、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 の詳細については、「 API リファレンスDeleteBucketLifecycle」の「」を参照してください。 AWS SDK for .NET

CLI
AWS CLI

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

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

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