anchor.diff:      (bindings-lifecycle-rules
        (xml-bind 'lifecycle-configuration (body response)))))
   
  -(defun delete-bucket-lifecycle (bucket)
  +(defun delete-bucket-lifecycle (bucket
  +                                &key
  +                                ((:credentials *credentials*) *credentials*))
     "Delete the lifecycle configuration of BUCKET."
     (submit-request (make-instance 'request
                                    :method :delete
                                    :bucket bucket
                                    :sub-resource "lifecycle")))
   
  -(defun (setf bucket-lifecycle) (rules bucket)
  +(defun (setf bucket-lifecycle) (rules bucket
  +                                &key
  +                                ((:credentials *credentials*) *credentials*))
     "Set the lifecycle configuration of BUCKET to RULES. RULES is
   coerced to a list if needed. If RULES is NIL, the lifecycle
   configuration is deleted with DELETE-BUCKET-LIFECYCLE."
  
positive.code: (defmethod enable ((rule lifecycle-rule))
    (setf (enabledp rule) t))
  
  (defun lifecycle-rule (&key id prefix (enabled t) days)
    (unless id
      (setf id (string (gensym))))
    (unless prefix
      (error "Missing PREFIX argument"))
    (unless days
      (error "Missing DAYS argument"))
    (make-instance 'lifecycle-rule
                   :id id
                   :prefix prefix
                   :enabledp enabled
                   :days days))
  
  (defun lifecycle-document (rules)
    (cxml:with-xml-output (cxml:make-octet-vector-sink)
      (cxml:with-element "LifecycleConfiguration"
        (dolist (rule rules)
          (cxml:with-element "Rule"
            (cxml:with-element "ID"
              (cxml:text (id rule)))
            (cxml:with-element "Prefix"
              (cxml:text (prefix rule)))
            (cxml:with-element "Status"
              (cxml:text (if (enabledp rule)
                             "Enabled"
                             "Disabled")))
            (cxml:with-element "Expiration"
              (cxml:with-element "Days"
                (cxml:text (princ-to-string (days rule))))))))))
  
  (defun bindings-lifecycle-rules (bindings)
    (let ((rules '()))
      (dolist (rule-bindings (bvalue :rules bindings) (nreverse rules))
        (alist-bind (id prefix status days)
            rule-bindings
          (push (make-instance 'lifecycle-rule
                               :id id
                               :prefix prefix
                               :enabledp (string= status "Enabled")
                               :days (parse-integer days))
                rules)))))
  
  (define-specific-error (no-such-lifecycle-configuration
                          "NoSuchLifecycleConfiguration")
      () ())
  
  ;;; FIXME: Add credentials args!
  
  (defun bucket-lifecycle (bucket)
    "Return the bucket lifecycle rules for BUCKET. Signals
  NO-SUCH-LIFECYCLE-CONFIGURATION if the bucket has no lifecycle
  configuration."
  
negative.code:                                    :sub-resource "lifecycle"
                                     :content-md5 md5
                                     :content content))))
  
  ;;; Restoring from glacier
  
  (defun restore-request-document (days)
    (with-xml-output
      (with-element "RestoreRequest"
        (with-element "Days"
          (text (princ-to-string days))))))
  
  (defun restore-object (bucket key &key
                         days
                         ((:credentials *credentials*) *credentials*))
    (let* ((content (restore-request-document days))
           (md5 (vector-md5/b64 content)))
      (submit-request (make-instance 'request
                                     :content-md5 md5
                                     :sub-resource "restore"
                                     :bucket bucket
                                     :key key))))
  