/** * Retrieves the current {@link ServiceProperties} for the given storage service. This includes Logging, * HourMetrics, MinuteMetrics and CORS configurations. * * @return A {@link ServiceProperties} object representing the current configuration of the service. * * @throws StorageException * If a storage service error occurred. */ @DoesServiceRequest public final ServiceProperties downloadServiceProperties() throws StorageException { return this.downloadServiceProperties(null /* options */, null /* opContext */); }
/** * Retrieves the current {@link ServiceProperties} for the given storage service. This includes Logging, * HourMetrics, MinuteMetrics and CORS configurations. * * @return A {@link ServiceProperties} object representing the current configuration of the service. * * @throws StorageException * If a storage service error occurred. */ @DoesServiceRequest public final ServiceProperties downloadServiceProperties() throws StorageException { return this.downloadServiceProperties(null /* options */, null /* opContext */); }
ServiceProperties blobServiceProperties = blobClient.downloadServiceProperties();
@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); } }
private ServiceProperties callDownloadServiceProperties(ServiceClient client) throws StorageException { if (client.getClass().equals(CloudBlobClient.class)) { CloudBlobClient blobClient = (CloudBlobClient) client; return blobClient.downloadServiceProperties(); } else if (client.getClass().equals(CloudTableClient.class)) { CloudTableClient tableClient = (CloudTableClient) client; return tableClient.downloadServiceProperties(); } else if (client.getClass().equals(CloudQueueClient.class)) { CloudQueueClient queueClient = (CloudQueueClient) client; return queueClient.downloadServiceProperties(); } else { fail(); } return null; }
@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); } } }