code: public BucketReplicationConfiguration addRule(String id,
              ReplicationRule rule) {
          if (id == null || id.trim().isEmpty()) {
              throw new IllegalArgumentException(
                      "Rule id cannot be null or empty.");
          }
          if (rule == null) {
              throw new IllegalArgumentException(
                      "Replication rule cannot be null");
          }
          rules.put(id, rule);
          return this;
      }
docs: Adds a new rule to the replication configuration associated with this
  Amazon S3 bucket. Returns the updated object.
  
  @param id
  the id for the rule.
  @param rule
  the replication rule for the Amazon S3 bucket.
  @throws IllegalArgumentException
  if the given id or rule is null.
  @return the updated {@link BucketReplicationConfiguration} object.