public FixedLengthInputStream marshall()

in src/main/java/com/aliyun/oss/common/parser/RequestMarshallers.java [966:1022]


        public FixedLengthInputStream marshall(AddBucketReplicationRequest request) {
            StringBuffer xmlBody = new StringBuffer();
            xmlBody.append("<ReplicationConfiguration>");
            xmlBody.append("<Rule>");
            xmlBody.append("<ID>" + escapeKey(request.getReplicationRuleID()) + "</ID>");
            xmlBody.append("<Destination>");
            xmlBody.append("<Bucket>" + request.getTargetBucketName() + "</Bucket>");
            if (request.getTargetBucketLocation() != null) {
                xmlBody.append("<Location>" + request.getTargetBucketLocation() + "</Location>");
            } else if (request.getTargetCloud() != null && request.getTargetCloudLocation() != null) {
                xmlBody.append("<Cloud>" + request.getTargetCloud() + "</Cloud>");
                xmlBody.append("<CloudLocation>" + request.getTargetCloudLocation() + "</CloudLocation>");
            }

            xmlBody.append("</Destination>");
            if (request.isEnableHistoricalObjectReplication()) {
                xmlBody.append("<HistoricalObjectReplication>" + "enabled" + "</HistoricalObjectReplication>");
            } else {
                xmlBody.append("<HistoricalObjectReplication>" + "disabled" + "</HistoricalObjectReplication>");
            }
            if (request.getObjectPrefixList() != null && request.getObjectPrefixList().size() > 0) {
                xmlBody.append("<PrefixSet>");
                for (String prefix : request.getObjectPrefixList()) {
                    xmlBody.append("<Prefix>" + prefix + "</Prefix>");
                }
                xmlBody.append("</PrefixSet>");
            }
            if (request.getReplicationActionList() != null && request.getReplicationActionList().size() > 0) {
                xmlBody.append("<Action>" + RequestMarshallers.joinRepliationAction(request.getReplicationActionList())
                        + "</Action>");
            }

            if (request.getSyncRole() != null) {
                xmlBody.append("<SyncRole>" + request.getSyncRole() + "</SyncRole>");
            }
            if (request.getReplicaKmsKeyID() != null) {
                xmlBody.append("<EncryptionConfiguration>");
                xmlBody.append("<ReplicaKmsKeyID>" + request.getReplicaKmsKeyID() + "</ReplicaKmsKeyID>");
                xmlBody.append("</EncryptionConfiguration>");
            }
            if (request.ENABLED.equals(request.getSseKmsEncryptedObjectsStatus()) ||
                    request.DISABLED.equals(request.getSseKmsEncryptedObjectsStatus())) {
                xmlBody.append("<SourceSelectionCriteria><SseKmsEncryptedObjects>");
                xmlBody.append("<Status>" + request.getSseKmsEncryptedObjectsStatus() + "</Status>");
                xmlBody.append("</SseKmsEncryptedObjects></SourceSelectionCriteria>");
            }

            if (request.getSourceBucketLocation() != null) {
                xmlBody.append("<Source>");
                xmlBody.append("<Location>" + request.getSourceBucketLocation() + "</Location>");
                xmlBody.append("</Source>");
            }

            xmlBody.append("</Rule>");
            xmlBody.append("</ReplicationConfiguration>");
            return stringMarshaller.marshall(xmlBody.toString());
        }