Get Object Lifecycle Rules
r2.buckets.lifecycle.get(strbucket_name, LifecycleGetParams**kwargs) -> LifecycleGetResponse
GET/accounts/{account_id}/r2/buckets/{bucket_name}/lifecycle
Get object lifecycle rules for a bucket.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Example:
Parameters
Get Object Lifecycle Rules
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
lifecycle = client.r2.buckets.lifecycle.get(
bucket_name="example-bucket",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
print(lifecycle.rules){
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
"string"
],
"result": {
"rules": [
{
"id": "Expire all objects older than 24 hours",
"conditions": {
"prefix": "prefix"
},
"enabled": true,
"abortMultipartUploadsTransition": {
"condition": {
"maxAge": 0,
"type": "Age"
}
},
"deleteObjectsTransition": {
"condition": {
"maxAge": 0,
"type": "Age"
}
},
"storageClassTransitions": [
{
"condition": {
"maxAge": 0,
"type": "Age"
},
"storageClass": "InfrequentAccess"
}
]
}
]
},
"success": true
}Returns Examples
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
"string"
],
"result": {
"rules": [
{
"id": "Expire all objects older than 24 hours",
"conditions": {
"prefix": "prefix"
},
"enabled": true,
"abortMultipartUploadsTransition": {
"condition": {
"maxAge": 0,
"type": "Age"
}
},
"deleteObjectsTransition": {
"condition": {
"maxAge": 0,
"type": "Age"
}
},
"storageClassTransitions": [
{
"condition": {
"maxAge": 0,
"type": "Age"
},
"storageClass": "InfrequentAccess"
}
]
}
]
},
"success": true
}