CloudTableClient tableClient = new CloudTableClient(baseUri, cred) { // Values supported can be AtomPub, Json, JsonFullMetadata or JsonNoMetadata PayloadFormat = TablePayloadFormat.JsonNoMetadata };
/** * Creates a new Table service client. * * @return A client object that uses the Table service endpoint. */ public CloudTableClient createCloudTableClient() { if (this.getTableStorageUri() == null) { throw new IllegalArgumentException(SR.TABLE_ENDPOINT_NOT_CONFIGURED); } if (this.credentials == null) { throw new IllegalArgumentException(SR.MISSING_CREDENTIALS); } if (!StorageCredentialsHelper.canCredentialsGenerateClient(this.credentials)) { throw new IllegalArgumentException(SR.CREDENTIALS_CANNOT_SIGN_REQUEST); } return new CloudTableClient(this.getTableStorageUri(), this.getCredentials()); }
/** * Creates a new Table service client. * * @return A client object that uses the Table service endpoint. */ public CloudTableClient createCloudTableClient() { if (this.getTableStorageUri() == null) { throw new IllegalArgumentException(SR.TABLE_ENDPOINT_NOT_CONFIGURED); } if (this.credentials == null) { throw new IllegalArgumentException(SR.MISSING_CREDENTIALS); } if (!StorageCredentialsHelper.canCredentialsGenerateClient(this.credentials)) { throw new IllegalArgumentException(SR.CREDENTIALS_CANNOT_SIGN_REQUEST); } return new CloudTableClient(this.getTableStorageUri(), this.getCredentials()); }
/** * Initializes a new instance of the <code>CloudAnalyticsClient</code> class using the specified blob and table * service endpoints and account credentials. * * @param blobStorageUri * A {@link StorageUri} object containing the Blob service endpoint to use to create the client. * @param tableStorageUri * A {@link StorageUri} object containing the Table service endpoint to use to create the client. * @param credentials * A {@link StorageCredentials} object. */ public CloudAnalyticsClient(StorageUri blobStorageUri, StorageUri tableStorageUri, StorageCredentials credentials) { Utility.assertNotNull("blobStorageUri", blobStorageUri); Utility.assertNotNull("tableStorageUri", tableStorageUri); this.blobClient = new CloudBlobClient(blobStorageUri, credentials); this.tableClient = new CloudTableClient(tableStorageUri, credentials); }
/** * Initializes a new instance of the <code>CloudAnalyticsClient</code> class using the specified blob and table * service endpoints and account credentials. * * @param blobStorageUri * A {@link StorageUri} object containing the Blob service endpoint to use to create the client. * @param tableStorageUri * A {@link StorageUri} object containing the Table service endpoint to use to create the client. * @param credentials * A {@link StorageCredentials} object. */ public CloudAnalyticsClient(StorageUri blobStorageUri, StorageUri tableStorageUri, StorageCredentials credentials) { Utility.assertNotNull("blobStorageUri", blobStorageUri); Utility.assertNotNull("tableStorageUri", tableStorageUri); this.blobClient = new CloudBlobClient(blobStorageUri, credentials); this.tableClient = new CloudTableClient(tableStorageUri, credentials); }
this.tableServiceClient = new CloudTableClient(PathUtility.getServiceClientBaseAddress( this.getStorageUri(), usePathStyleUris), credentials != null ? credentials : parsedCredentials); this.name = PathUtility.getTableNameFromUri(storageUri.getPrimaryUri(), usePathStyleUris);
private static void testIsUsePathStyleUri(StorageCredentials creds, String tableEndpoint, boolean usePathStyleUris) throws URISyntaxException, InvalidKeyException, StorageException { CloudTableClient tableClient = new CloudTableClient(new URI(tableEndpoint), creds); assertEquals(usePathStyleUris, tableClient.isUsePathStyleUris()); CloudTable table = tableClient.getTableReference("mytable"); assertEquals(tableEndpoint + "/mytable", table.getUri().toString()); String sasToken = table.generateSharedAccessSignature(null, "fakeIdentifier", null, null, null, null); tableClient = new CloudTableClient(new URI(tableEndpoint), new StorageCredentialsSharedAccessSignature(sasToken)); assertEquals(usePathStyleUris, tableClient.isUsePathStyleUris()); table = new CloudTable(table.getUri(), tableClient.getCredentials()); assertEquals(tableEndpoint + "/mytable", table.getUri().toString()); }
this.tableServiceClient = new CloudTableClient(PathUtility.getServiceClientBaseAddress( this.getStorageUri(), usePathStyleUris), credentials != null ? credentials : parsedCredentials); this.name = PathUtility.getTableNameFromUri(storageUri.getPrimaryUri(), usePathStyleUris);
@Test public void testTableTypesWithStorageUri() throws URISyntaxException, StorageException { CloudTableClient tableClient = TestHelper.createCloudTableClient(); StorageUri endpoint = new StorageUri(new URI("http://" + ACCOUNT_NAME + TABLE_SERVICE + ENDPOINT_SUFFIX), new URI("http://" + ACCOUNT_NAME + SECONDARY_SUFFIX + TABLE_SERVICE + ENDPOINT_SUFFIX)); CloudTableClient client = new CloudTableClient(endpoint, tableClient.getCredentials()); assertEquals(endpoint, client.getStorageUri()); assertEquals(endpoint.getPrimaryUri(), client.getEndpoint()); StorageUri tableUri = new StorageUri(new URI(endpoint.getPrimaryUri() + "/table"), new URI( endpoint.getSecondaryUri() + "/table")); CloudTable table = client.getTableReference("table"); assertEquals(tableUri, table.getStorageUri()); assertEquals(tableUri.getPrimaryUri(), table.getUri()); assertEquals(endpoint, table.getServiceClient().getStorageUri()); table = new CloudTable(tableUri, client.getCredentials()); assertEquals(tableUri, table.getStorageUri()); assertEquals(tableUri.getPrimaryUri(), table.getUri()); assertEquals(endpoint, table.getServiceClient().getStorageUri()); } }
CloudTableClient tableClientFromPermission = new CloudTableClient(tClient.getEndpoint(), new StorageCredentialsSharedAccessSignature(sasString)); table.generateSharedAccessSignature((SharedAccessTablePolicy) null, identifier, "javatables_batch_0", "0", "javatables_batch_9", "9")); CloudTableClient tableClient = new CloudTableClient(policySasTable.getServiceClient().getStorageUri(), creds);