• Object Storage Service

obs
  1. Help Center
  2. Object Storage Service
  3. API Reference (OBS)
  4. Operations on Buckets
  5. PUT Bucket lifecycle
  6. Examples

Examples

Sample Request 1

PUT /?lifecycle HTTP/1.1
 User-Agent: curl/7.29.0
 Host: bucketname.obs.example.com
 Date: Thu, 05 Sep 2013 09:35:44 +0000 
 Authorization: AWS B9A70C60A39C4D551A16:MOO0dUPmAAEXEe0/z+Q9LCx1Vzc= 
 Content-MD5: Sa2ttwkV/+XRCwEHg4N8ow== 
 Content-Length: 423
 Expect: 100-continue

<LifecycleConfiguration>
<Rule>
<ID>delete-2-days</ID>
<Prefix>test/</Prefix>
<Status>Enabled</Status>
<Expiration>
<Days>365</Days>
</Expiration>
<NoncurrentVersionExpiration>
<NoncurrentDays>365</NoncurrentDays>
</NoncurrentVersionExpiration>
<Transition> 
<Days>30</Days> 
<StorageClass>STANDARD_IA</StorageClass> 
</Transition> 
<Transition> 
<Days>60</Days> 
<StorageClass>GLACIER</StorageClass> 
</Transition> 
<NoncurrentVersionTransition> 
<NoncurrentDays>30</NoncurrentDays> 
<StorageClass>STANDARD_IA</StorageClass> 
</NoncurrentVersionTransition> 
<NoncurrentVersionTransition> 
<NoncurrentDays>60</NoncurrentDays> 
<StorageClass>GLACIER</StorageClass> 
</NoncurrentVersionTransition>
</Rule>
</LifecycleConfiguration>

Sample Response 1

HTTP/1.1 200 OK 
 Date: Thu, 05 Sep 2013 09:35:44 GMT 
 Server: OBS 
 x-amz-request-id: 90E2BA0A420C00000140ED7A369007A2 
 x-amz-id-2: t35S98JCFKUMswCPZCk+UTi/VOoiSenzi5J6wnoKCIMfXUsKYGgU5+daiWAYiY/8 
 x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc 
 Content-Length: 0

Sample Request 2

PUT /?lifecycle HTTP/1.1
User-Agent: curl/7.29.0
Host: bucketname.obs.example.comDate: Thu, 05 Sep 2015 09:35:44 +0000
Authorization: AWS B9A70C60A39C4D551A16:MOO0dUPmAAEXEe0/z+Q9LCx1Vzc=
Content-MD5: Sa2ttwkV/+XRCwEHg4N8ow==
Content-Length: 423
Expect: 100-continue
<LifecycleConfiguration>
<Rule>
<ID>delete-2-days</ID>
<Prefix>test/</Prefix>
<Status>Enabled</Status>
<Expiration>
<Days>365</Days>
</Expiration>
<Transition> 
<Days>30</Days> 
<StorageClass>STANDARD_IA</StorageClass> 
</Transition> 
<Transition> 
<Days>60</Days> 
<StorageClass>GLACIER</StorageClass> 
</Transition> 
<NoncurrentVersionTransition> 
<NoncurrentDays>30</NoncurrentDays> 
<StorageClass>STANDARD_IA</StorageClass> 
</NoncurrentVersionTransition> 
<NoncurrentVersionTransition> 
<NoncurrentDays>60</NoncurrentDays> 
<StorageClass>GLACIER</StorageClass> 
</NoncurrentVersionTransition>
</Rule>
</LifecycleConfiguration>

Sample Response 2

HTTP/1.1 200 OK
Date: Thu, 05 Sep 2015 09:35:44 GMT
x-amz-request-id: 90E2BA0A420C00000140ED7A369007A2
x-amz-id-2: t35S98JCFKUMswCPZCk+UTi/VOoiSenzi5J6wnoKCIMfXUsKYGgU5+daiWAYiY/8
x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc
Content-Length: 0