@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); } } }
private void testAnalyticsLoggingOperations(ServiceClient client, ServiceProperties props) throws StorageException, InterruptedException { // None props.getLogging().setLogOperationTypes(EnumSet.noneOf(LoggingOperations.class)); props.getLogging().setRetentionIntervalInDays(null); props.getLogging().setVersion("1.0"); callUploadServiceProps(client, props, null); assertServicePropertiesAreEqual(props, callDownloadServiceProperties(client)); // None props.getLogging().setLogOperationTypes(EnumSet.allOf(LoggingOperations.class)); callUploadServiceProps(client, props, null); assertServicePropertiesAreEqual(props, callDownloadServiceProperties(client)); }
private void testAnalyticsDisable(ServiceClient client, ServiceProperties props) throws StorageException, InterruptedException { props.getLogging().setLogOperationTypes(EnumSet.noneOf(LoggingOperations.class)); props.getLogging().setRetentionIntervalInDays(null); props.getLogging().setVersion("1.0"); props.getHourMetrics().setMetricsLevel(MetricsLevel.DISABLED); props.getHourMetrics().setRetentionIntervalInDays(null); props.getHourMetrics().setVersion("1.0"); props.getMinuteMetrics().setMetricsLevel(MetricsLevel.DISABLED); props.getMinuteMetrics().setRetentionIntervalInDays(null); props.getMinuteMetrics().setVersion("1.0"); props.getCors().getCorsRules().clear(); callUploadServiceProps(client, props, null); assertServicePropertiesAreEqual(props, callDownloadServiceProperties(client)); }
private void testOptionalServiceProperties(ServiceClient client, ServiceProperties props) throws StorageException, InterruptedException { props.getLogging().setLogOperationTypes(EnumSet.of(LoggingOperations.READ, LoggingOperations.WRITE)); props.getLogging().setRetentionIntervalInDays(5); props.getLogging().setVersion("1.0");
props.getLogging().setLogOperationTypes(EnumSet.noneOf(LoggingOperations.class)); callUploadServiceProps(client, props, null); props.getLogging().setLogOperationTypes(EnumSet.noneOf(LoggingOperations.class)); callUploadServiceProps(client, props, null); props.getLogging().setLogOperationTypes(EnumSet.allOf(LoggingOperations.class)); callUploadServiceProps(client, props, null); props.getLogging().setLogOperationTypes(EnumSet.allOf(LoggingOperations.class)); callUploadServiceProps(client, props, null);