use of com.microsoft.azure.storage.table.CloudTableClient in project stdlib by petergeneric.
the class ServiceManagerGuiceModule method getLogDataTable.
/**
* For the Azure Log Store, the underlying table to use
*
* @param storageConnectionString
*
* @return
*
* @throws URISyntaxException
* @throws StorageException
* @throws InvalidKeyException
*/
@Provides
@Named("logdata")
public CloudTable getLogDataTable(@Named("azure.storage-connection-string") String storageConnectionString, @Named("azure.logging-table") String logTableName) throws URISyntaxException, StorageException, InvalidKeyException {
// Retrieve storage account from connection-string.
CloudStorageAccount storageAccount = CloudStorageAccount.parse(storageConnectionString);
// Create the table client.
CloudTableClient tableClient = storageAccount.createCloudTableClient();
// Create the table if it doesn't exist.
CloudTable table = tableClient.getTableReference(logTableName);
table.createIfNotExists();
return table;
}
Aggregations