View a markdown version of this page

Usar DeleteBucketLifecycle com o AWS SDK ou a CLI - Amazon Simple Storage Service

Usar DeleteBucketLifecycle com o AWS SDK ou a CLI

Os exemplos de código a seguir mostram como usar DeleteBucketLifecycle.

.NET
SDK para .NET
nota

Há mais no GitHub. Encontre o exemplo completo e saiba como configurar e executar no AWSCode Examples Repository.

/// <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); }
CLI
AWS CLI

O seguinte comando exclui a configuração de ciclo de vida do bucket amzn-s3-demo-bucket:

aws s3api delete-bucket-lifecycle --bucket amzn-s3-demo-bucket
Python
SDK para Python (Boto3).
nota

Há mais no GitHub. Encontre o exemplo completo e saiba como configurar e executar no AWSCode Examples Repository.

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
SAP ABAP
SDK para SAP ABAP
nota

Há mais no GitHub. Encontre o exemplo completo e saiba como configurar e executar no AWSCode Examples Repository.

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.
  • Para obter detalhes da API, consulte DeleteBucketLifecycle na Referência da API do SDK da AWS para SAP ABAP.

Para ver uma lista completa dos guias de desenvolvedor e exemplos de código do SDK da AWS, consulte Desenvolvimento com o Amazon S3 usando AWS SDKs. Este tópico também inclui informações sobre como começar e detalhes sobre versões anteriores do SDK.