/** * Converts the specified logging configuration into an XML byte array. * * @param loggingConfiguration * The configuration to convert. * * @return The XML byte array representation. */ public byte[] convertToXmlByteArray(BucketLoggingConfiguration loggingConfiguration) { // Default log file prefix to the empty string if none is specified String logFilePrefix = loggingConfiguration.getLogFilePrefix(); if (logFilePrefix == null) logFilePrefix = ""; XmlWriter xml = new XmlWriter(); xml.start("BucketLoggingStatus", "xmlns", Constants.XML_NAMESPACE); if (loggingConfiguration.isLoggingEnabled()) { xml.start("LoggingEnabled"); xml.start("TargetBucket").value(loggingConfiguration.getDestinationBucketName()).end(); xml.start("TargetPrefix").value(loggingConfiguration.getLogFilePrefix()).end(); xml.end(); } xml.end(); return xml.getBytes(); }
@Test public void testUnknownParameter() throws Exception { try { client.setBucketLoggingConfiguration( new SetBucketLoggingConfigurationRequest( containerName, new BucketLoggingConfiguration())); Fail.failBecauseExceptionWasNotThrown(AmazonS3Exception.class); } catch (AmazonS3Exception e) { assertThat(e.getErrorCode()).isEqualTo("NotImplemented"); } }
@Override public BucketLoggingConfiguration getBucketLoggingConfiguration(String bucketName) throws AmazonClientException, AmazonServiceException { return delegate.getBucketLoggingConfiguration(bucketName); }
@Override public BucketLoggingConfiguration getBucketLoggingConfiguration(GetBucketLoggingConfigurationRequest getBucketLoggingConfigurationRequest) throws AmazonClientException, AmazonServiceException { return delegate.getBucketLoggingConfiguration(getBucketLoggingConfigurationRequest); }
@Override public BucketLoggingConfiguration getBucketLoggingConfiguration(String bucketName) throws AmazonClientException, AmazonServiceException { throw new UnsupportedOperationException(); }
@Override public BucketLoggingConfiguration getBucketLoggingConfiguration(String bucketName) throws SdkClientException, AmazonServiceException { return call(() -> getDelegate().getBucketLoggingConfiguration(bucketName)); }
@Override public BucketLoggingConfiguration getBucketLoggingConfiguration(GetBucketLoggingConfigurationRequest getBucketLoggingConfigurationRequest) throws SdkClientException, AmazonServiceException { return call(() -> getDelegate().getBucketLoggingConfiguration(getBucketLoggingConfigurationRequest)); }
@Override public BucketLoggingConfiguration getBucketLoggingConfiguration(String bucketName) throws AmazonClientException { return null; }
@Override public BucketLoggingConfiguration getBucketLoggingConfiguration(String bucketName) throws AmazonClientException, AmazonServiceException { // TODO Auto-generated method stub return null; }