use of com.microsoft.azure.storage.ServiceProperties in project cyberduck by iterate-ch.
the class AzureLoggingFeature method getConfiguration.
@Override
public LoggingConfiguration getConfiguration(final Path container) throws BackgroundException {
try {
final ServiceProperties properties = session.getClient().downloadServiceProperties(null, context);
final LoggingConfiguration configuration = new LoggingConfiguration(!properties.getLogging().getLogOperationTypes().isEmpty(), "$logs");
// When you have configured Storage Logging to log request data from your storage account, it saves the log data
// to blobs in a container named $logs in your storage account.
configuration.setContainers(Collections.singletonList(new Path("/$logs", EnumSet.of(Path.Type.volume, Path.Type.directory))));
return configuration;
} catch (StorageException e) {
throw new AzureExceptionMappingService().map("Cannot read container configuration", e);
}
}
use of com.microsoft.azure.storage.ServiceProperties in project cyberduck by iterate-ch.
the class AzureLoggingFeature method setConfiguration.
@Override
public void setConfiguration(final Path container, final LoggingConfiguration configuration) throws BackgroundException {
try {
final ServiceProperties properties = session.getClient().downloadServiceProperties(null, context);
final LoggingProperties l = new LoggingProperties();
if (configuration.isEnabled()) {
l.setLogOperationTypes(EnumSet.allOf(LoggingOperations.class));
} else {
l.setLogOperationTypes(EnumSet.noneOf(LoggingOperations.class));
}
properties.setLogging(l);
session.getClient().uploadServiceProperties(properties, null, context);
} catch (StorageException e) {
throw new AzureExceptionMappingService().map("Failure to write attributes of {0}", e, container);
}
}
Aggregations