diff --git a/Microsoft.HBase.Client/HBaseClient.cs b/Microsoft.HBase.Client/HBaseClient.cs
index 3ccead4..797b5eb 100644
--- a/Microsoft.HBase.Client/HBaseClient.cs
+++ b/Microsoft.HBase.Client/HBaseClient.cs
@@ -45,6 +45,11 @@ public sealed class HBaseClient : IHBaseClient
private readonly WebRequester _requester;
private readonly IRetryPolicyFactory _retryPolicyFactory;
+ ///
+ /// Base uri for hbase rest api
+ ///
+ public string RestEndpointBase { get; set; }
+
///
/// Initializes a new instance of the class.
///
@@ -97,7 +102,7 @@ public async Task CreateScannerAsync(string tableName, Scann
IRetryPolicy retryPolicy = _retryPolicyFactory.Create();
try
{
- using (HttpWebResponse response = await PostRequestAsync(tableName + "/scanner", scannerSettings, WebRequester.RestEndpointBaseZero))
+ using (HttpWebResponse response = await PostRequestAsync(tableName + "/scanner", scannerSettings, RestEndpointBase ?? WebRequester.RestEndpointBaseZero))
{
if (response.StatusCode != HttpStatusCode.Created)
{
@@ -159,7 +164,7 @@ public async Task CreateTableAsync(TableSchema schema)
IRetryPolicy retryPolicy = _retryPolicyFactory.Create();
try
{
- using (HttpWebResponse webResponse = await PutRequestAsync(schema.name + "/schema", schema))
+ using (HttpWebResponse webResponse = await PutRequestAsync(schema.name + "/schema", schema, RestEndpointBase))
{
if (webResponse.StatusCode == HttpStatusCode.Created)
{
@@ -219,7 +224,7 @@ public async Task DeleteTableAsync(string table)
IRetryPolicy retryPolicy = _retryPolicyFactory.Create();
try
{
- using (HttpWebResponse webResponse = await DeleteRequestAsync(table + "/schema", null))
+ using (HttpWebResponse webResponse = await DeleteRequestAsync(table + "/schema", null, RestEndpointBase))
{
if (webResponse.StatusCode != HttpStatusCode.OK)
{
@@ -278,7 +283,7 @@ public async Task GetCellsAsync(string tableName, string rowKey)
IRetryPolicy retryPolicy = _retryPolicyFactory.Create();
try
{
- return await GetRequestAndDeserializeAsync(tableName + "/" + rowKey);
+ return await GetRequestAndDeserializeAsync(tableName + "/" + rowKey, RestEndpointBase);
}
catch (Exception e)
{
@@ -312,7 +317,7 @@ public async Task GetStorageClusterStatusAsync()
IRetryPolicy retryPolicy = _retryPolicyFactory.Create();
try
{
- return await GetRequestAndDeserializeAsync("/status/cluster");
+ return await GetRequestAndDeserializeAsync("/status/cluster", RestEndpointBase);
}
catch (Exception e)
{
@@ -349,7 +354,7 @@ public async Task GetTableInfoAsync(string table)
IRetryPolicy retryPolicy = _retryPolicyFactory.Create();
try
{
- return await GetRequestAndDeserializeAsync(table + "/regions");
+ return await GetRequestAndDeserializeAsync(table + "/regions", RestEndpointBase);
}
catch (Exception e)
{
@@ -387,7 +392,7 @@ public async Task GetTableSchemaAsync(string table)
IRetryPolicy retryPolicy = _retryPolicyFactory.Create();
try
{
- return await GetRequestAndDeserializeAsync(table + "/schema");
+ return await GetRequestAndDeserializeAsync(table + "/schema", RestEndpointBase);
}
catch (Exception e)
{
@@ -421,7 +426,7 @@ public org.apache.hadoop.hbase.rest.protobuf.generated.Version GetVersion()
IRetryPolicy retryPolicy = _retryPolicyFactory.Create();
try
{
- return await GetRequestAndDeserializeAsync("version");
+ return await GetRequestAndDeserializeAsync("version", RestEndpointBase);
}
catch (Exception e)
{
@@ -454,9 +459,8 @@ public async Task ListTablesAsync()
IRetryPolicy retryPolicy = _retryPolicyFactory.Create();
try
{
- return await GetRequestAndDeserializeAsync("");
+ return await GetRequestAndDeserializeAsync("", RestEndpointBase);
}
-
catch (Exception e)
{
if (!retryPolicy.ShouldRetryAttempt(e))
@@ -496,7 +500,7 @@ public async Task ModifyTableSchemaAsync(string table, TableSchema schema)
IRetryPolicy retryPolicy = _retryPolicyFactory.Create();
try
{
- using (HttpWebResponse webResponse = await PostRequestAsync(table + "/schema", schema))
+ using (HttpWebResponse webResponse = await PostRequestAsync(table + "/schema", schema, RestEndpointBase))
{
if (webResponse.StatusCode != HttpStatusCode.OK || webResponse.StatusCode != HttpStatusCode.Created)
{
@@ -553,7 +557,7 @@ public async Task ScannerGetNextAsync(ScannerInformation scannerInfo)
{
using (
HttpWebResponse webResponse =
- await GetRequestAsync(scannerInfo.TableName + "/scanner/" + scannerInfo.ScannerId, WebRequester.RestEndpointBaseZero))
+ await GetRequestAsync(scannerInfo.TableName + "/scanner" + scannerInfo.ScannerId, RestEndpointBase ?? WebRequester.RestEndpointBaseZero))
{
if (webResponse.StatusCode == HttpStatusCode.OK)
{
@@ -600,7 +604,7 @@ public async Task StoreCellsAsync(string table, CellSet cells)
try
{
// note the fake row key to insert a set of cells
- using (HttpWebResponse webResponse = await PutRequestAsync(table + "/somefalsekey", cells))
+ using (HttpWebResponse webResponse = await PutRequestAsync(table + "/somefalsekey", cells, RestEndpointBase))
{
if (webResponse.StatusCode != HttpStatusCode.OK)
{