public byte[] convertToXmlByteArray(BucketReplicationConfiguration replicationConfiguration) { XmlWriter xml = new XmlWriter(); xml.start("ReplicationConfiguration"); Map<String, ReplicationRule> rules = replicationConfiguration .getRules(); final String role = replicationConfiguration.getRoleARN(); xml.start("Role").value(role).end(); for (Map.Entry<String, ReplicationRule> entry : rules .entrySet()) { final String ruleId = entry.getKey(); final ReplicationRule rule = entry.getValue(); xml.start("Rule"); xml.start("ID").value(ruleId).end(); xml.start("Prefix").value(rule.getPrefix()).end(); xml.start("Status").value(rule.getStatus()).end(); final ReplicationDestinationConfig config = rule.getDestinationConfig(); xml.start("Destination"); xml.start("Bucket").value(config.getBucketARN()).end(); if (config.getStorageClass() != null) { xml.start("StorageClass").value(config.getStorageClass()).end(); } xml.end(); xml.end(); } xml.end(); return xml.getBytes(); }
@Override public void setBucketReplicationConfiguration(String bucketName, BucketReplicationConfiguration configuration) throws AmazonServiceException, AmazonClientException { delegate.setBucketReplicationConfiguration(bucketName, configuration); }
@Override public BucketReplicationConfiguration getBucketReplicationConfiguration(String bucketName) throws AmazonServiceException, AmazonClientException { return delegate.getBucketReplicationConfiguration(bucketName); }
@Override public BucketReplicationConfiguration getBucketReplicationConfiguration(GetBucketReplicationConfigurationRequest getBucketReplicationConfigurationRequest) throws AmazonServiceException, AmazonClientException { return delegate.getBucketReplicationConfiguration(getBucketReplicationConfigurationRequest); }
@Override public void setBucketReplicationConfiguration(String bucketName, BucketReplicationConfiguration configuration) throws AmazonServiceException, AmazonServiceException { run(() -> getDelegate().setBucketReplicationConfiguration(bucketName, configuration)); }
@Override public BucketReplicationConfiguration getBucketReplicationConfiguration(String bucketName) throws AmazonServiceException, AmazonServiceException { return call(() -> getDelegate().getBucketReplicationConfiguration(bucketName)); }
@Override public BucketReplicationConfiguration getBucketReplicationConfiguration(GetBucketReplicationConfigurationRequest getBucketReplicationConfigurationRequest) throws AmazonServiceException, AmazonServiceException { return call(() -> getDelegate().getBucketReplicationConfiguration(getBucketReplicationConfigurationRequest)); }
@Override public void setBucketReplicationConfiguration(String bucketName, BucketReplicationConfiguration bucketReplicationConfiguration) throws AmazonClientException { }
@Override public BucketReplicationConfiguration getBucketReplicationConfiguration(String bucketName) throws AmazonClientException { return null; }