本文整理汇总了Java中com.microsoft.azure.storage.table.CloudTableClient.downloadServiceProperties方法的典型用法代码示例。如果您正苦于以下问题:Java CloudTableClient.downloadServiceProperties方法的具体用法?Java CloudTableClient.downloadServiceProperties怎么用?Java CloudTableClient.downloadServiceProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.microsoft.azure.storage.table.CloudTableClient
的用法示例。
在下文中一共展示了CloudTableClient.downloadServiceProperties方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: corsRules
import com.microsoft.azure.storage.table.CloudTableClient; //导入方法依赖的package包/类
/**
* Set CORS rules sample.
* @param tableClient Azure Storage Table Service
*/
private void corsRules(CloudTableClient tableClient) throws StorageException {
// Get service properties
System.out.println("Get service properties");
ServiceProperties originalProps = tableClient.downloadServiceProperties();
try {
// Setr CORS rules
System.out.println("Set CORS rules");
CorsRule ruleAllowAll = new CorsRule();
ruleAllowAll.getAllowedOrigins().add("*");
ruleAllowAll.getAllowedMethods().add(CorsHttpMethods.GET);
ruleAllowAll.getAllowedHeaders().add("*");
ruleAllowAll.getExposedHeaders().add("*");
ServiceProperties props = new ServiceProperties();
props.getCors().getCorsRules().add(ruleAllowAll);
tableClient.uploadServiceProperties(props);
}
finally {
// Revert back to original service properties
tableClient.uploadServiceProperties(originalProps);
}
}
示例2: callDownloadServiceProperties
import com.microsoft.azure.storage.table.CloudTableClient; //导入方法依赖的package包/类
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;
}
示例3: serviceProperties
import com.microsoft.azure.storage.table.CloudTableClient; //导入方法依赖的package包/类
/**
* Manage the service properties including logging hour and minute metrics.
* @param tableClient Azure Storage Table Service
*/
private void serviceProperties(CloudTableClient tableClient) throws StorageException {
System.out.println("Get service properties");
ServiceProperties originalProps = tableClient.downloadServiceProperties();
try {
System.out.println("Set service properties");
// Change service properties
ServiceProperties props = new ServiceProperties();
props.getLogging().setLogOperationTypes(EnumSet.allOf(LoggingOperations.class));
props.getLogging().setRetentionIntervalInDays(2);
props.getLogging().setVersion("1.0");
final MetricsProperties hours = props.getHourMetrics();
hours.setMetricsLevel(MetricsLevel.SERVICE_AND_API);
hours.setRetentionIntervalInDays(1);
hours.setVersion("1.0");
final MetricsProperties minutes = props.getMinuteMetrics();
minutes.setMetricsLevel(MetricsLevel.SERVICE);
minutes.setRetentionIntervalInDays(1);
minutes.setVersion("1.0");
tableClient.uploadServiceProperties(props);
System.out.println();
System.out.println("Logging");
System.out.printf("version: %s%n", props.getLogging().getVersion());
System.out.printf("retention interval: %d%n", props.getLogging().getRetentionIntervalInDays());
System.out.printf("operation types: %s%n", props.getLogging().getLogOperationTypes());
System.out.println();
System.out.println("Hour Metrics");
System.out.printf("version: %s%n", props.getHourMetrics().getVersion());
System.out.printf("retention interval: %d%n", props.getHourMetrics().getRetentionIntervalInDays());
System.out.printf("operation types: %s%n", props.getHourMetrics().getMetricsLevel());
System.out.println();
System.out.println("Minute Metrics");
System.out.printf("version: %s%n", props.getMinuteMetrics().getVersion());
System.out.printf("retention interval: %d%n", props.getMinuteMetrics().getRetentionIntervalInDays());
System.out.printf("operation types: %s%n", props.getMinuteMetrics().getMetricsLevel());
System.out.println();
}
finally {
// Revert back to original service properties
tableClient.uploadServiceProperties(originalProps);
}
}