code: public void setBucketLifeCycle(String bucketName, String lifeCycle)
            throws InvalidBucketNameException, NoSuchAlgorithmException,
            InsufficientDataException, IOException, InvalidKeyException, NoResponseException,
            XmlPullParserException, ErrorResponseException, InternalException,InvalidArgumentException {
      if ((lifeCycle == null) || "".equals(lifeCycle)) {
        throw new InvalidArgumentException("life cycle cannot be empty");
      }
      Map<String, String> headerMap = new HashMap<>();
      headerMap.put("Content-Length", Integer.toString(lifeCycle.length()));
      Map<String, String> queryParamMap = new HashMap<>();
      queryParamMap.put("lifecycle", "");
      HttpResponse response = executePut(bucketName, null, headerMap, queryParamMap, lifeCycle, 0);
      response.body().close();
    }
docs: Set XML string of LifeCycle on a given bucket.
  Delete the lifecycle of bucket in case a null is passed as lifeCycle.
  @param bucketName   Bucket name.
  @param lifeCycle    Bucket policy XML string.
  
  </p><b>Example:</b><br>
  <pre>{@code String lifecycle  = "<LifecycleConfiguration><Rule><ID>expire-bucket</ID><Prefix></Prefix>"
  + "<Status>Enabled</Status><Expiration><Days>365</Days></Expiration></Rule></LifecycleConfiguration>";
  
  setBucketLifecycle("my-bucketname", lifecycle); }</pre>
  @throws InvalidBucketNameException  upon invalid bucket name is given
  @throws NoSuchAlgorithmException    upon requested algorithm was not found during
  signature calculation
  @throws InsufficientDataException   upon getting EOFException while reading given
  InputStream even before reading given length
  @throws IOException                 upon connection error
  @throws InvalidKeyException         upon an invalid access key or secret key
  @throws NoResponseException         upon no response from server
  @throws XmlPullParserException      upon parsing response xml
  @throws ErrorResponseException      upon unsuccessful execution
  @throws InternalException           upon internal library error
  @throws InvalidArgumentException    upon invalid value is passed to a method.