类 MolaDbClient
- java.lang.Object
-
- com.baidubce.AbstractBceClient
-
- com.baidubce.services.moladb.MolaDbClient
-
public class MolaDbClient extends AbstractBceClient
Represents the MolaDb client to access MolaDb.
-
-
字段概要
-
从类继承的字段 com.baidubce.AbstractBceClient
config, DEFAULT_CONTENT_TYPE, DEFAULT_ENCODING, DEFAULT_SERVICE_DOMAIN, URL_PREFIX
-
-
构造器概要
构造器 构造器 说明 MolaDbClient(MolaDbClientConfiguration conf)Constructs a new Moladb client using the client configuration to access Moladb.
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 BatchGetItemResponsebatchGetItem(BatchGetItemRequest request)The BatchGetItem operation get items with the given primary keys from Moladb.BatchWriteItemResponsebatchWriteItem(BatchWriteItemRequest request)The BatchWriteItem operation write items with to Moladb.CreateInstanceResponsecreateInstance(CreateInstanceRequest request)Creates a new instance under same account.protected InternalRequestcreateRequest(HttpMethodName httpMethod, String... pathVariables)protected InternalRequestcreateRequestUnderInstance(HttpMethodName httpMethod, String... pathVariables)CreateTableResponsecreateTable(CreateTableRequest request)Create a table in moladbDeleteInstanceResponsedeleteInstance(DeleteInstanceRequest request)Delete instance from MoladbDeleteInstanceResponsedeleteInstance(String instanceName)Delete instance from MoladbDeleteItemResponsedeleteItem(DeleteItemRequest request)The DeleteItem operation delete the item with the given primary key.DeleteTableResponsedeleteTable(DeleteTableRequest request)Delete a table from moladbDeleteTableResponsedeleteTable(String tableName)Delete the specified table from moladbprotected voidfillInHeadAndBody(AbstractBceRequest request, InternalRequest httpRequest)StringgetDefaultInstanceName()Get the default instance name.GetInstanceResponsegetInstance(GetInstanceRequest request)Get instance detail from MoladbGetInstanceResponsegetInstance(String instanceName)Get instance detail from MoladbGetItemResponsegetItem(GetItemRequest request)The GetItem operation returns a set of attributes for the item with the given primary key.GetTableResponsegetTable(GetTableRequest request)Get the table details from moladbGetTableResponsegetTable(String tableName)Get the table details from moladbListInstancesResponselistInstances()Get all instance names created by this accountListInstancesResponselistInstances(ListInstancesRequest request)Get the instance name list created by this accountListTablesResponselistTables()List all table names under the specified instance name from moladbListTablesResponselistTables(ListTablesRequest request)List all table names under the specified instance name from moladbPutItemResponseputItem(PutItemRequest request)Creates a new item, or replaces an old item with a new item.QueryResponsequery(QueryRequest request)The Query operation get items from Moladb with Hash Key and an interval of Range KeyvoidsetDefaultInstanceName(String instanceName)Set the default instance name.UpdateItemResponseupdateItem(UpdateItemRequest request)The UpdateItem operation update the item with the given primary key.UpdateTableResponseupdateTable(UpdateTableRequest request)Update a table in moladb-
从类继承的方法 com.baidubce.AbstractBceClient
computeBktVirEndpoint, computeServiceId, getBktVirEndpoint, getClient, getEndpoint, getServiceId, invokeHttpClient, isRegionSupported, setClient, shutdown
-
-
-
-
构造器详细资料
-
MolaDbClient
public MolaDbClient(MolaDbClientConfiguration conf)
Constructs a new Moladb client using the client configuration to access Moladb.- 参数:
conf- The Moladb client configuration options controlling how this client connects to Moladb (e.g. proxy settings, retry counts, etc).
-
-
方法详细资料
-
setDefaultInstanceName
public void setDefaultInstanceName(String instanceName)
Set the default instance name. Operation on tables and items will be carried on this instance
- 参数:
instanceName- Default instance name to be set
-
getDefaultInstanceName
public String getDefaultInstanceName()
Get the default instance name.
- 返回:
- Default instance name
-
createInstance
public CreateInstanceResponse createInstance(CreateInstanceRequest request)
Creates a new instance under same account.
- 参数:
request- Container for the necessary parameters to execute the Create instance service method on Moladb.- 返回:
- The responseContent from the Create instance service method, as returned by Moladb.
- 抛出:
BceClientException- If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.BceServiceException- If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.
-
getInstance
public GetInstanceResponse getInstance(String instanceName)
Get instance detail from Moladb
- 参数:
instanceName- Name of the instance to be got from Moladb.- 返回:
- The responseContent from the Get instance service method, as returned by Moladb.
- 抛出:
BceClientException- If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.BceServiceException- If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.
-
getInstance
public GetInstanceResponse getInstance(GetInstanceRequest request)
Get instance detail from Moladb
- 参数:
request- Container for the necessary parameters to execute the Get instance service method on Moladb.- 返回:
- The responseContent from the Get instance service method, as returned by Moladb.
- 抛出:
BceClientException- If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.BceServiceException- If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.
-
deleteInstance
public DeleteInstanceResponse deleteInstance(DeleteInstanceRequest request)
Delete instance from Moladb
NOTE: There MUST be no table within the instance to be deleted.- 参数:
request- Container for the necessary parameters to execute the Delete instance service method on Moladb.- 返回:
- The responseContent from the Delete instance service method, as returned by Moladb.
- 抛出:
BceClientException- If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.BceServiceException- If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.
-
deleteInstance
public DeleteInstanceResponse deleteInstance(String instanceName)
Delete instance from Moladb
NOTE: There MUST be no table within the instance to be deleted.- 参数:
instanceName- the name of instance to be deleted.- 返回:
- The responseContent from the Delete instance service method, as returned by Moladb.
- 抛出:
BceClientException- If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.BceServiceException- If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.
-
listInstances
public ListInstancesResponse listInstances()
Get all instance names created by this account
- 返回:
- The responseContent from the List instance service method, as returned by Moladb.
- 抛出:
BceClientException- If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.BceServiceException- If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.
-
listInstances
public ListInstancesResponse listInstances(ListInstancesRequest request)
Get the instance name list created by this account
- 参数:
request- Container for the necessary parameters to execute the list instance service method on Moladb.- 返回:
- The responseContent from the List instance service method, as returned by Moladb.
- 抛出:
BceClientException- If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.BceServiceException- If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.
-
createTable
public CreateTableResponse createTable(CreateTableRequest request)
Create a table in moladb
- 参数:
request- Container for the necessary parameters to execute the create table service method on Moladb.- 返回:
- The responseContent from the Create table service method, as returned by Moladb.
- 抛出:
BceClientException- If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.BceServiceException- If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.
-
deleteTable
public DeleteTableResponse deleteTable(String tableName)
Delete the specified table from moladb
- 参数:
tableName- Name of the table to be deleted from Moladb.- 返回:
- The responseContent from the Delete table service method, as returned by Moladb.
- 抛出:
BceClientException- If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.BceServiceException- If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.
-
deleteTable
public DeleteTableResponse deleteTable(DeleteTableRequest request)
Delete a table from moladb
- 参数:
request- Container for the necessary parameters to execute the delete table service method on Moladb.- 返回:
- The responseContent from the Delete table service method, as returned by Moladb.
- 抛出:
BceClientException- If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.BceServiceException- If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.
-
updateTable
public UpdateTableResponse updateTable(UpdateTableRequest request)
Update a table in moladb
- 参数:
request- Container for the necessary parameters to execute the update table service method on Moladb.- 返回:
- The responseContent from the Update table service method, as returned by Moladb.
- 抛出:
BceClientException- If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.BceServiceException- If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.
-
getTable
public GetTableResponse getTable(String tableName)
Get the table details from moladb
- 参数:
tableName- Name of table to be get from Moladb.- 返回:
- The responseContent from the Get table service method, as returned by Moladb.
- 抛出:
BceClientException- If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.BceServiceException- If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.
-
getTable
public GetTableResponse getTable(GetTableRequest request)
Get the table details from moladb
- 参数:
request- Container for the necessary parameters to execute the GetTable service method on Moladb.- 返回:
- The responseContent from the Get table service method, as returned by Moladb.
- 抛出:
BceClientException- If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.BceServiceException- If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.
-
listTables
public ListTablesResponse listTables()
List all table names under the specified instance name from moladb
- 返回:
- The responseContent from the list tables service method, as returned by Moladb.
- 抛出:
BceClientException- If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.BceServiceException- If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.
-
listTables
public ListTablesResponse listTables(ListTablesRequest request)
List all table names under the specified instance name from moladb
- 参数:
request- Container for the necessary parameters to execute the ListTables service method on Moladb.- 返回:
- The responseContent from the list tables service method, as returned by Moladb.
- 抛出:
BceClientException- If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.BceServiceException- If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.
-
putItem
public PutItemResponse putItem(PutItemRequest request)
Creates a new item, or replaces an old item with a new item. If an item that has the same primary key as the new item already exists in the specified table, the new item completely replaces the existing item. You can perform a conditional put operation (add a new item if one with the specified primary key doesn't exist), or replace an existing item if it has certain attribute values.
When you add an item, the primary key attribute(s) are the only required attributes. Attribute values cannot be null. String and Binary type attributes must have lengths greater than zero. Set type attributes cannot be empty.
- 参数:
request- Container for the necessary parameters to execute the PutItem service method on Moladb.- 返回:
- The responseContent from the PutItem service method, as returned by Moladb.
- 抛出:
BceClientException- If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.BceServiceException- If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.
-
getItem
public GetItemResponse getItem(GetItemRequest request) throws BceClientException, BceServiceException
The GetItem operation returns a set of attributes for the item with the given primary key. If there is no matching item, GetItem does not return any data.
GetItem provides an eventually consistent read by default. If your application requires a strongly consistent read, set ConsistentRead to
true. Although a strongly consistent read might take more time than an eventually consistent read, it always returns the last updated value.- 参数:
request- Container for the necessary parameters to execute the GetItem request.- 返回:
- The responseContent from the GetItem service method, as returned by Moladb.
- 抛出:
BceClientException- If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.BceServiceException- If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.
-
deleteItem
public DeleteItemResponse deleteItem(DeleteItemRequest request) throws BceClientException, BceServiceException
The DeleteItem operation delete the item with the given primary key. If there is no matching item, DeleteItem does not return any data.
- 参数:
request- Container for the necessary parameters to execute the DeleteItem request.- 返回:
- The responseContent from the DeleteItem service method, as returned by Moladb.
- 抛出:
BceClientException- If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.BceServiceException- If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.
-
updateItem
public UpdateItemResponse updateItem(UpdateItemRequest request) throws BceClientException, BceServiceException
The UpdateItem operation update the item with the given primary key. If there is no matching item, UpdateItem does not return any data.
- 参数:
request- Container for the necessary parameters to execute the UpdateItem request.- 返回:
- The responseContent from the UpdateItem service method, as returned by Moladb.
- 抛出:
BceClientException- If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.BceServiceException- If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.
-
batchGetItem
public BatchGetItemResponse batchGetItem(BatchGetItemRequest request) throws BceClientException, BceServiceException
The BatchGetItem operation get items with the given primary keys from Moladb. If there is no matching item, BatchGetItem does not return any data.
The BatchGetItem can get items from multi tables with corresponding keys. These tables MUST under same instance.
- 参数:
request- Container for the necessary parameters to execute the BatchGetItem request.- 返回:
- The responseContent from the BatchGetItem service method, as returned by Moladb.
- 抛出:
BceClientException- If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.BceServiceException- If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.
-
batchWriteItem
public BatchWriteItemResponse batchWriteItem(BatchWriteItemRequest request) throws BceClientException, BceServiceException
The BatchWriteItem operation write items with to Moladb.
The BatchGetItem can write items within multi tables. These tables MUST under same instance.
- 参数:
request- Container for the necessary parameters to execute the BatchWriteItem request.- 返回:
- The responseContent from the BatchWriteItem service method, as returned by Moladb.
- 抛出:
BceClientException- If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.BceServiceException- If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.
-
query
public QueryResponse query(QueryRequest request) throws BceClientException, BceServiceException
The Query operation get items from Moladb with Hash Key and an interval of Range Key
The Query operation is only support on tables whose Primary key type is HashAndRange Key
- 参数:
request- Container for the necessary parameters to execute the Query request.- 返回:
- The responseContent from the Query service method, as returned by Moladb.
- 抛出:
BceClientException- If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.BceServiceException- If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.
-
createRequest
protected InternalRequest createRequest(HttpMethodName httpMethod, String... pathVariables)
-
createRequestUnderInstance
protected InternalRequest createRequestUnderInstance(HttpMethodName httpMethod, String... pathVariables)
-
fillInHeadAndBody
protected void fillInHeadAndBody(AbstractBceRequest request, InternalRequest httpRequest)
-
-