百度智能云

All Product Document

          Object Storage

          GetBucketLifecycle

          Interface Description

          This interface is used to get the defined lifecycle management rule details.

          Request

          • Request syntax

            GET /?lifecycle HTTP/1.1
            Host: <BucketName>.bj.bcebos.com
            Date: date
            Authorization: AuthorizationString
          • Request header field

            No special parameters.

          • Request parameters

            No special parameters.

          Response

          • Request parameters

            Rule Item Description Required? Remarks
            rule List of rules Required List of all rules
            +id Rule ID. Required The rule ID in the same bucket must be unique and cannot be duplicated. If the user does not enter this field, the system automatically generates one for the user.
            +status Status of rules. Required The value is enabled or disabled. The rule is not effective when it is in the disabled status.
            +resource For which resources is the rule effective? Required For example, the rule is effective for the object with prefix/ in samplebucket: samplebucket/prefix/*. The rule is effective for all objects in samplebucket: samplebucket/*.
            +condition Rule dependent conditions Required At present, it can be in the time form only.
            +time Time constraint Required It is implemented by the defined dateGreaterThan.
            ++dateGreaterThan Time relation description Required It can be the absolute time (date) and the relative time (days). The format of the absolute time (date) is yyyy-mm-ddThh:mm:ssZ, eg., 2016-09-07T00:00:00Z. The absolute time is the UTC time and must end with 00:00:00 (UTC 00:00). The description of the relative time (days) conforms to ISO8601, and the minimum time granularity supported is days. For example, $(lastModified)+P7D indicates the time for seven days after the last modification of the object.
            action Action performed on resource Required -
            +name Name of action performed Required The value is Transition, DeleteObject, or AbortMultipartUpload.
            +storageClass Storage type of object Optional It can be set when the action is Transition, and the value is STANDARD_IA, COLD or ARCHIVE, indicating that the original storage type is switched to the infrequent access or cold storage or archive storage.
          • Response element

            No special element

          • Response header field

            No special header field.

          Considerations

          • If the requested source bucket does not exist, it returns “Error 404: NoSuchBucket”.
          • If the requested source bucket is not configured with the lifecycle, it returns “Error 404: NoLifecycleConfiguration”.

          Example

          • Request example

             GET /?lifecycle HTTP/1.1
             Host: bucket.bj.bcebos.com
             Date: Thu, 15 Sep 2016 00:16:26 GMT
             Authorization: AuthorizationString
          • Response example

                  HTTP/1.1 200 OK
                  Date: Thu, 15 Sep 2016 00:17:23 GMT
                  Server: BceBos
                  x-bce-request-id: 1a5fd81e-626b-45b3-a885-15fff9cd106c
                  Connection: keep-alive
                  Content-Length: 358
            
                  {
                      "rule": [
                          {
                              "id": "sample-rule-delete-prefix", 
                              "status": "enabled", 
                              "resource": [
                                  "bucket/prefix/*"
                              ], 
                              "condition": {
                                  "time": {
                                      "dateGreaterThan": "2016-09-07T00:00:00Z"
                                  }
                              }, 
                              "action": {
                                  "name": "DeleteObject"
                              }
                          },
                          {
                              "id": "sample-rule-transition-prefix", 
                              "status": "enabled", 
                              "resource": [
                                  "bucket/prefix/*"
                              ], 
                              "condition": {
                                  "time": {
                                      "dateGreaterThan": "$(lastModified)+P7D"
                                  }
                              }, 
                              "action": {
                                  "name": "Transition",
                                  "storageClass": "STANDARD_IA"
                              }
                          },
                          {
                              "id": "sample-rule-abort-multiupload-prefix", 
                              "status": "enabled", 
                              "resource": [
                                  "bucket/prefix/*"
                              ], 
                              "condition": {
                                  "time": {
                                      "dateGreaterThan": "$(lastModified)+P7D"
                                  }
                              }, 
                              "action": {
                                  "name": "AbortMultipartUpload"
                              }
                          }
                      ]
                  }  
          Previous
          DeleteBucketLifecycle
          Next
          Log Management