/*
 * Copyright (C) Alibaba Cloud Computing All rights reserved.
 */
package com.aliyun.openservices.log;

import com.aliyun.openservices.log.common.*;
import com.aliyun.openservices.log.common.Consts.CursorMode;
import com.aliyun.openservices.log.exception.LogException;
import com.aliyun.openservices.log.request.*;
import com.aliyun.openservices.log.response.*;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;


public interface LogService {

	/**
	 * Get The log status(histogram info) from log service server which match
	 * input parameters. All the logs with logstore and topic in [from, to)
	 * which contain the keys in query are the matched data.
	 *
	 * @param project
	 *            the project name
	 * @param logstore
	 *            the result data logstore
	 * @param from
	 *            the begin time of the result data to get
	 * @param to
	 *            the end time of the result data to get
	 * @param topic
	 *            the result data topic
	 *
	 * @param query
	 *            If the query is not empty, it will return the logs contain the
	 *            keys in query, if "all_hit" is contained in the query, only
	 *            the logs contains all the keys in query are matched logs,
	 *            other wise logs contain any key in query are matched logs.
	 * @return the histogram response of the matched logs
	 * @throws LogException
	 *             if any error happen when get the data from log service server
	 * @throws NullPointerException
	 *             if any parameter is null
	 * @throws IllegalArgumentException
	 *             if project or logstore is empty
	 */
    GetHistogramsResponse GetHistograms(String project, String logstore,
                                        int from, int to, String topic, String query) throws LogException;

	/**
	 * Get The log status(histogram info) from log service server which match
	 * input parameters. All the logs with logstore and topic in [from, to)
	 * which contain the keys in query are the matched data.
	 *
	 * @param request
	 *            the get histogram request
	 * @return the histogram response of the matched logs
	 * @throws LogException
	 *             if any error happen when get the data from log service server
	 * @throws NullPointerException
	 *             if required parameter is null
	 */
    GetHistogramsResponse GetHistograms(GetHistogramsRequest request)
			throws LogException;

	/**
	 * Get The sub set of logs data from log service server which match input
	 * parameters. By default, it will return at most 20 lines
	 *
	 * @param project
	 *            the project name
	 * @param logStore
	 *            the result data logstore
	 * @param from
	 *            the begin time of the result data to get
	 * @param to
	 *            the end time of the result data to get
	 * @param topic
	 *            the result data topic
	 * @param query
	 *            If the query is not empty, it will return the logs contain the
	 *            keys in query, if "all_hit" is contained in the query, only
	 *            the logs contains all the keys in query are matched logs,
	 *            other wise logs contain any key in query are matched logs
	 * @return a response contains a sub set of the logs matched the input
	 *         parameters
	 * @throws LogException
	 *             if any error happen when get the data from log service server
	 * @throws NullPointerException
	 *             if any parameter is null
	 * @throws IllegalArgumentException
	 *             if project or logstore is empty
	 */
    GetLogsResponse GetLogs(String project, String logStore, int from,
                            int to, String topic, String query) throws LogException;

	/**
	 * Get The sub set of logs data from log service server which match input
	 * parameters. All the data with logstore and topic in [from, to) which
	 * contain the keys in query are the matched data.
	 *
	 * @param project
	 *            the project name
	 * @param logStore
	 *            the result data logstore
	 * @param from
	 *            the begin time of the result data to get
	 * @param to
	 *            the end time of the result data to get
	 * @param topic
	 *            the result data topic
	 * @param reverse
	 *            a flag to determine the return data order, if reverse is set
	 *            to false, the return logs is ascending order by time, other
	 *            wise, it's descending order
	 * @param line
	 *            how many lines to get, the max lines is decided by the sls
	 *            backend server
	 * @param offset
	 *            the start log index in all the matched logs.
	 * @param query
	 *            If the query is not empty, it will return the logs contain the
	 *            keys in query, if "all_hit" is contained in the query, only
	 *            the logs contains all the keys in query are matched logs,
	 *            other wise logs contain any key in query are matched logs.
	 * @param powerSql
	 *            if the query runs using a power instance
	 * @return a response contains a sub set of the logs matched the input
	 *         parameters
	 * @throws LogException
	 *             if any error happen when get the data from log service server
	 * @throws NullPointerException
	 *             if any parameter is null
	 * @throws IllegalArgumentException
	 *             if project or logstore is empty
	 */
    GetLogsResponse GetLogs(String project, String logStore, int from,
                            int to, String topic, String query, long line, long offset,
                            boolean reverse,
							boolean powerSql) throws LogException;

	/**
	 * Get The sub set of logs data from log service server which match input
	 * parameters. All the data with logstore and topic in [from, to) which
	 * contain the keys in query are the matched data.
	 *
	 * @param project
	 *            the project name
	 * @param logStore
	 *            the result data logstore
	 * @param from
	 *            the begin time of the result data to get
	 * @param to
	 *            the end time of the result data to get
	 * @param topic
	 *            the result data topic
	 * @param reverse
	 *            a flag to determine the return data order, if reverse is set
	 *            to false, the return logs is ascending order by time, other
	 *            wise, it's descending order
	 * @param line
	 *            how many lines to get, the max lines is decided by the sls
	 *            backend server
	 * @param offset
	 *            the start log index in all the matched logs.
	 * @param query
	 *            If the query is not empty, it will return the logs contain the
	 *            keys in query, if "all_hit" is contained in the query, only
	 *            the logs contains all the keys in query are matched logs,
	 *            other wise logs contain any key in query are matched logs.
	 * @param powerSql
	 *            if the query runs using a power instance
	 * @return a response contains a sub set of the logs matched the input
	 *         parameters
	 * @throws LogException
	 *             if any error happen when get the data from log service server
	 * @throws NullPointerException
	 *             if any parameter is null
	 * @throws IllegalArgumentException
	 *             if project or logstore is empty
	 */
	GetLogsResponse GetLogs(String project, String logStore, int from,
							int to, String topic, String query, long line, long offset,
							boolean reverse,
							boolean powerSql,
							boolean forward) throws LogException;

	/**
	 * Get The sub set of logs data from log service server which match input
	 * parameters. All the data with logstore and topic in [from, to) which
	 * contain the keys in query are the matched data.
	 *
	 * @param project
	 *            the project name
	 * @param logStore
	 *            the result data logstore
	 * @param from
	 *            the begin time of the result data to get
	 * @param to
	 *            the end time of the result data to get
	 * @param topic
	 *            the result data topic
	 * @param reverse
	 *            a flag to determine the return data order, if reverse is set
	 *            to false, the return logs is ascending order by time, other
	 *            wise, it's descending order
	 * @param line
	 *            how many lines to get, the max lines is decided by the sls
	 *            backend server
	 * @param offset
	 *            the start log index in all the matched logs.
	 * @param query
	 *            If the query is not empty, it will return the logs contain the
	 *            keys in query, if "all_hit" is contained in the query, only
	 *            the logs contains all the keys in query are matched logs,
	 *            otherwise logs contain any key in query are matched logs.
	 * @param session
	 *            query session param, should be like powerSql=true;schema_free=true;....
	 * @return a response contains a sub set of the logs matched the input
	 *         parameters
	 * @throws LogException
	 *             if any error happen when get the data from log service server
	 * @throws NullPointerException
	 *             if any parameter is null
	 * @throws IllegalArgumentException
	 *             if project or logstore is empty
	 */
	GetLogsResponse GetLogs(String project, String logStore, int from,
							int to, String topic, String query, long line, long offset,
							boolean reverse, boolean forward, String session) throws LogException;

	/**
	 * Get The sub set of logs data from log service server which match input
	 * parameters.
	 *
	 * @param request
	 *            the get logs request
	 * @return a response contains a sub set of the logs matched the input
	 *         parameters
	 * @throws NullPointerException
	 *             if required parameter is null
	 * @throws LogException
	 *             if any error happen when get the data from log service server
	 */
    GetLogsResponse GetLogs(GetLogsRequest request) throws LogException;

	/**
	 * Execute the SQL in the Project and Logstore with input parameters.
	 *
	 * @param project
	 *            the project name
	 * @param logStore
	 *            the logstore name
	 * @param from
	 *            the begin time of the data to get
	 * @param to
	 *            the end time of the data to get
	 * @param sql
	 *            the sql string which must follow <a href="https://help.aliyun.com/document_detail/43772.html">Search|Analysis syntax in SLS</a>
	 * @param powerSql
	 *            execute in enhanced sql mode if true, or normal mode if false
	 * @return a response contains a result set of the sql
	 * @throws LogException
	 *             if any error happen when get the data from log service server
	 * @throws NullPointerException
	 *             if any parameter is null
	 * @throws IllegalArgumentException
	 *             if project or logstore is empty
	 */
	GetLogsResponse executeLogstoreSql(String project, String logStore, int from,
									   int to, String sql, boolean powerSql) throws LogException;

	/**
	 * compute logs with a sql query from the whole project
	 *
	 * @param project
	 *            the project name
	 * @param query
	 *            stardard sql query, compute from the whole project
	 * @return a response contains a sub set of the logs matched the input
	 *         parameters
	 * @throws LogException
	 *             if any error happen when get the data from log service server
	 * @throws NullPointerException
	 *             if any parameter is null
	 * @throws IllegalArgumentException
	 *             if project or logstore is empty
	 */
    GetLogsResponse GetProjectLogs(String project, String query) throws LogException;


	/**
	 * compute logs with a sql query from the whole project
	 *
	 * @param request
	 *            the get project logs request
	 * @return a response contains a sub set of the logs matched the input
	 *         parameters
	 * @throws NullPointerException
	 *             if required parameter is null
	 * @throws LogException
	 *             if any error happen when get the data from log service server
	 */
    GetLogsResponse GetProjectLogs(GetProjectLogsRequest request) throws LogException;

	/**
	 * Execute the SQL in the Project with input parameters.
	 *
	 * @param project
	 *            the project name
	 * @param sql
	 *            the sql string which must follow SQL syntax
	 * @param powerSql
	 *            execute in enhanced sql mode if true, or normal mode if false
	 * @return a response contains a result set of the sql
	 * @throws LogException
	 *             if any error happen when get the data from log service server
	 * @throws NullPointerException
	 *             if any parameter is null
	 * @throws IllegalArgumentException
	 *             if project or logstore is empty
	 */
	GetLogsResponse executeProjectSql(String project, String sql, boolean powerSql) throws LogException;

	/**
	 * get all the logstore between offset to (offset + size - 1) under given project
	 *
	 * @param project
	 *            the project name
	 *
	 * @param offset
	 *            the begin offset
	 *
	 * @param size
	 *            the query logstore name count
	 *
	 * @return the user's logstore response
	 * @throws LogException
	 *             if any error happen when get the data from log service server
	 * @throws NullPointerException
	 *             if any parameter is null
	 * @throws IllegalArgumentException
	 *             if project is empty
	 */
	ListLogStoresResponse ListLogStores(String project, int offset, int size) throws LogException;

	/**
	 * Get all the logstore for the user
	 *
	 * @param project
	 *            the project name
	 *
	 * @param offset
	 *            the begin offset
	 *
	 * @param size
	 *            the query logstore name count
	 *
	 * @param logstoreName
	 *            part name of the logstore, only return the logstores which
	 *            contains the input name
	 *
	 * @return the user's logstore response
	 * @throws LogException
	 *             if any error happen when get the data from log service server
	 * @throws NullPointerException
	 *             if any parameter is null
	 * @throws IllegalArgumentException
	 *             if project or logstore is empty
	 */
    ListLogStoresResponse ListLogStores(String project, int offset,
                                        int size, String logstoreName) throws LogException;

	/**
	 * Get all the logstore of a project
	 *
	 * @param request
	 *            the list log store request
	 * @return the user's logstore response
	 * @throws LogException
	 *             if any error happen when get the data from log service server
	 * @throws NullPointerException
	 *             if required parameter is null
	 */
    ListLogStoresResponse ListLogStores(ListLogStoresRequest request)
			throws LogException;

	/**
	 * Send Data to log service server
	 *
	 * @param project
	 *            the project name
	 * @param logStore
	 *            the log store where the source data should be put
	 * @param topic
	 *            source data topic
	 * @param logItems
	 *            the log data to send
	 *
	 * @param source
	 *            the source of the data, if the source is empty, it will be
	 *            reset to the host ip
	 *
	 * @return The put logs response
	 *
	 * @throws LogException
	 *             if any error happen when send data to the server
	 * @throws NullPointerException
	 *             if any parameter is null
	 * @throws IllegalArgumentException
	 *             if project or logstore is empty, or the logGroup log count
	 *             exceed 4096, or the total data size exceed 5MB
	 */
    PutLogsResponse PutLogs(String project, String logStore,
                            String topic, List<LogItem> logItems, String source)
			throws LogException;

	/**
	 * Send Data to log service server
	 *
	 * @param project
	 *            the project name
	 * @param logStore
	 *            the log store where the source data should be put
	 * @param topic
	 *            source data topic
	 * @param logItems
	 *            the log data to send
	 * @param source
	 *            the source of the data, if the source is empty, it will be
	 *            reset to the host ip
	 * @param shardHash
	 *            the hash key md5value (00000000000000000000000000000000 ~
	 *            ffffffffffffffffffffffffffffffff)
	 * @return The put logs response
	 * @throws LogException
	 *             if any error happen when send data to the server
	 * @throws NullPointerException
	 *             if any parameter is null
	 * @throws IllegalArgumentException
	 *             if project or logstore is empty, or the logGroup log count
	 *             exceed 4096, or the total data size exceed 5MB
	 */
    PutLogsResponse PutLogs(String project, String logStore,
                            String topic, List<LogItem> logItems, String source,
                            String shardHash) throws LogException;
	/**
	 * Send Data to log service server
	 *
	 * @param request
	 *            the put log request
	 *
	 * @return The put logs response
	 *
	 * @throws LogException
	 *             if any error happen when send data to the server
	 * @throws NullPointerException
	 *             if any parameter is null
	 * @throws IllegalArgumentException
	 *             if project or logstore is empty, or the logGroup log count
	 *             exceed 4096, or the total data size exceed 5MB
	 */
    PutLogsResponse PutLogs(PutLogsRequest request) throws LogException;


		/**
	 * Send Data to log service server in batches
	 *
	 * @param request
	 *            the batch put log request
	 *
	 * @return The batch put logs response
	 *
	 * @throws LogException
	 *             if any error happen when send data to the server
	 * @throws NullPointerException
	 *             if any parameter is null
	 * @throws IllegalArgumentException
	 *             if project or logstore is empty, or the total logGroup log count
	 *             exceed 4096, or the total data size exceed 5MB
	 */
    BatchPutLogsResponse batchPutLogs(BatchPutLogsRequest request) throws LogException;

	/**
	 * Put an object to the specified logstore.
	 * Unsuccessful operation will cause a LogException.
	 *
	 * @param project    the project name
	 * @param logStore   the logstore name
	 * @param objectName the object name (only allow a-z A-Z 0-9 _ -)
	 * @param content    the object content as InputStream (can be null for empty content)
	 * @return PutObjectResponse
	 * @throws LogException if any error happen when put the object
	 */
	PutObjectResponse putObject(String project, String logStore, String objectName, java.io.InputStream content) throws LogException;

	/**
	 * Put an object to the specified logstore with headers.
	 * Unsuccessful operation will cause a LogException.
	 *
	 * @param project    the project name
	 * @param logStore   the logstore name
	 * @param objectName the object name (only allow a-z A-Z 0-9 _ -)
	 * @param content    the object content as InputStream (can be null for empty content)
	 * @param headers    optional headers to send with the request
	 *                   - x-log-meta-* headers will be attached to the object as metadata
	 *                   - Content-Type will be attached to the object as metadata
	 *                   - Content-MD5 will be attached to the object as metadata
	 * @return PutObjectResponse
	 * @throws LogException if any error happen when put the object
	 */
	PutObjectResponse putObject(String project, String logStore, String objectName, java.io.InputStream content, java.util.Map<String, String> headers) throws LogException;

	/**
	 * Put an object to the specified logstore.
	 * Unsuccessful operation will cause a LogException.
	 *
	 * @param request the put object request
	 * @return PutObjectResponse
	 * @throws LogException if any error happen when put the object
	 */
	PutObjectResponse putObject(PutObjectRequest request) throws LogException;

	/**
	 * Get an object from the specified logstore.
	 * Unsuccessful operation will cause a LogException.
	 *
	 * @param project    the project name
	 * @param logStore   the logstore name
	 * @param objectName the object name
	 * @return GetObjectResponse Note: The caller is responsible for closing the response
	 * @throws LogException if any error happen when get the object
	 */
	GetObjectResponse getObject(String project, String logStore, String objectName) throws LogException;

	/**
	 * Get an object from the specified logstore.
	 * Unsuccessful operation will cause a LogException.
	 *
	 * @param request the get object request
	 * @return GetObjectResponse Note: The caller is responsible for closing the response
	 * @throws LogException if any error happen when get the object
	 */
	GetObjectResponse getObject(GetObjectRequest request) throws LogException;

	/**
	 * List objects in the specified logstore.
	 *
	 * @param request the list objects request
	 * @return ListObjectsResponse containing the list of objects
	 * @throws LogException if any error happens when listing objects
	 */
	ListObjectsResponse listObjects(ListObjectsRequest request) throws LogException;

	/**
	 * Put logstore multimodal configuration.
	 *
	 * @param request the put logstore multimodal configuration request
	 * @return VoidResponse
	 * @throws LogException if any error happens when putting the configuration
	 */
	VoidResponse putLogStoreMultimodalConfiguration(PutLogStoreMultimodalConfigurationRequest request) throws LogException;

	/**
	 * Get logstore multimodal configuration.
	 *
	 * @param request the get logstore multimodal configuration request
	 * @return GetLogStoreMultimodalConfigurationResponse containing the configuration
	 * @throws LogException if any error happens when getting the configuration
	 */
	GetLogStoreMultimodalConfigurationResponse getLogStoreMultimodalConfiguration(GetLogStoreMultimodalConfigurationRequest request) throws LogException;

	/**
	 * Get cursor from log service server
	 *
	 * @param project
	 *            the project name
	 * @param logStore
	 *            the log store name
	 * @param shardId
	 *            the shard where the cursor should be get
	 * @param fromTime
	 *            the from time of log data in unix time stamp sec
	 *
	 * @return The get cursor response
	 *
	 * @throws LogException
	 *             if any error happen when get cursor from the server
	 * @throws NullPointerException
	 *             if any parameter is null
	 * @throws IllegalArgumentException
	 *             if project or logStore is empty
	 */
    GetCursorResponse GetCursor(String project, String logStore,
                                int shardId, long fromTime) throws LogException;

	/**
	 * Get cursor from log service server
	 *
	 * @param project
	 *            the project name
	 * @param logStore
	 *            the log store name
	 * @param shardId
	 *            the shard where the cursor should be get
	 * @param fromTime
	 *            the from time of log data in java Date
	 *
	 * @return The get cursor response
	 *
	 * @throws LogException
	 *             if any error happen when get cursor from the server
	 * @throws NullPointerException
	 *             if any parameter is null
	 * @throws IllegalArgumentException
	 *             if any string argument in request is empty
	 */
    GetCursorResponse GetCursor(String project, String logStore,
                                int shardId, Date fromTime) throws LogException;

	/**
	 * Get cursor from log service server
	 *
	 * @param project
	 *            the project name
	 * @param logStore
	 *            the log store name
	 * @param shardId
	 *            the shard where the cursor should be get
	 * @param mode
	 *            the mode to get cursor, include BEGIN and END
	 *
	 * @return The get cursor response
	 *
	 * @throws LogException
	 *             if any error happen when get cursor from the server
	 * @throws NullPointerException
	 *             if any parameter is null
	 * @throws IllegalArgumentException
	 *             if any string argument in request is empty
	 */
    GetCursorResponse GetCursor(String project, String logStore,
                                int shardId, CursorMode mode) throws LogException;

	/**
	 * Get cursor from log service server
	 *
	 * @param request
	 *            the get cursor request
	 *
	 * @return The get cursor response
	 *
	 * @throws LogException
	 *             if any error happen when get cursor from the server
	 * @throws NullPointerException
	 *             if any parameter is null
	 * @throws IllegalArgumentException
	 *             if any string argument in request is empty
	 */
    GetCursorResponse GetCursor(GetCursorRequest request) throws LogException;

	/**
	 * Get the receive time of the package according to the cursor
	 *
	 * @param project
	 *            the project name
	 * @param logStore
	 *            the logstore name
	 * @param shardId
	 *            shard id
	 * @param cursor
	 *            cursor of a shard
	 * @return the cursor time response
	 * @throws LogException
	 *             if any error happen when get cursor from the server
	 * @throws NullPointerException
	 *             if any parameter is null
	 * @throws IllegalArgumentException
	 *             if any string argument in request is empty
	 */
    GetCursorTimeResponse GetCursorTime(String project, String logStore,
                                        int shardId, String cursor) throws LogException;

	/**
	 * Get the receive time of the package according to the cursor
	 *
	 * @param request
	 *            the request
	 * @return cursor time response * @throws LogException if any error happen
	 *         when get cursor from the server
	 * @throws NullPointerException
	 *             if any parameter is null
	 * @throws IllegalArgumentException
	 *             if any string argument in request is empty
	 */
    GetCursorTimeResponse GetCursorTime(GetCursorTimeRequest request)
			throws LogException;
	/**
	 * Get the shards in the logtstore
	 *
	 * @param project
	 *            the project name
	 * @param logStore
	 *            where the shard belongs to
	 *
	 * @return the log store's shards response
	 *
	 * @throws LogException
	 *             if any error happen when get the data from log service server
	 * @throws NullPointerException
	 *             if any parameter is null
	 * @throws IllegalArgumentException
	 *             if project or logstore is empty
	 */
    ListShardResponse ListShard(String project, String logStore) throws LogException;

	/**
	 * Get the shards in the logtstore
	 *
	 * @param request
	 *            the get cursor request
	 *
	 * @return the log store's shards response
	 *
	 * @throws LogException
	 *             if any error happen when get the data from log service server
	 * @throws NullPointerException
	 *             if any parameter is null
	 * @throws IllegalArgumentException
	 *             if project or logstore in request is empty
	 */
    ListShardResponse ListShard(ListShardRequest request) throws LogException;

	/**
	 * split a readwrite shard in the logtstore
	 *
	 * @param project
	 *            the project name
	 * @param logStore
	 *            where the shard belongs to
	 * @param shardId
	 *            the shard id to split
	 * @param midHash
	 *            the middle md5 hash string to split the shard
	 *
	 * @return the splited shard and two new generated readwrite shard
	 *
	 * @throws LogException
	 *             if any error happen when get the data from log service server
	 * @throws NullPointerException
	 *             if any parameter is null
	 * @throws IllegalArgumentException
	 *             if project or logstore in request is empty
	 */
    ListShardResponse SplitShard(String project, String logStore,
                                 int shardId, String midHash) throws LogException;

	/**
	 * split a readwrite shard in the logtstore
	 *
	 * @param request
	 *            split shard request
	 *
	 * @return the splited shard and two new generated readwrite shard
	 *
	 * @throws LogException
	 *             if any error happen when get the data from log service server
	 * @throws NullPointerException
	 *             if any parameter is null
	 * @throws IllegalArgumentException
	 *             if project or logstore in request is empty
	 */
    ListShardResponse SplitShard(SplitShardRequest request) throws LogException;

	/**
	 * merge two readwrite shards in the logtstore
	 *
	 * @param project
	 *            the project name
	 * @param logStore
	 *            where the shard belongs to
	 * @param shardId
	 *            the shard id to merge with right adjacent shard
	 *
	 * @return the merges shards and new generated readwrite shard
	 *
	 * @throws LogException
	 *             if any error happen when get the data from log service server
	 * @throws NullPointerException
	 *             if any parameter is null
	 * @throws IllegalArgumentException
	 *             if project or logstore in request is empty
	 */
    ListShardResponse MergeShards(String project, String logStore,
                                  int shardId) throws LogException;

	/**
	 * merge two readwrite shards in the logtstore
	 *
	 * @param request
	 *            the project name
	 *
	 * @return the merges shards and new generated readwrite shard
	 *
	 * @throws LogException
	 *             if any error happen when get the data from log service server
	 * @throws NullPointerException
	 *             if any parameter is null
	 * @throws IllegalArgumentException
	 *             if project or logstore in request is empty
	 */
    ListShardResponse MergeShards(MergeShardsRequest request) throws LogException;

	/**
	 * Batch get log
	 *
	 * @param project
	 *            the project name
	 * @param logStore
	 *            where the shard belongs to
	 * @param shardId
	 *            the shard to batch get log
	 * @param count
	 *            the logrgroup num
	 * @param cursor
	 *            the cursor to batch get log
	 *
	 * @return batch get log response
	 *
	 * @throws LogException
	 *             if any error happen when get the data from log service server
	 * @throws NullPointerException
	 *             if any parameter is null
	 * @throws IllegalArgumentException
	 *             if project or logstore or cursor is empty
     * @deprecated Please use {@code pullLogs} instead.
	 */
	@Deprecated
    BatchGetLogResponse BatchGetLog(String project, String logStore,
                                    int shardId, int count, String cursor) throws LogException;

	/**
	 * Batch get log
	 *
	 * @param project
	 *            the project name
	 * @param logStore
	 *            where the shard belongs to
	 * @param shardId
	 *            the shard to batch get log
	 * @param count
	 *            the logrgroup num
	 * @param cursor
	 *            the cursor to batch get log
	 *
	 * @param end_cursor
	 * 			  the end cursor to batch get log
	 *
	 * @return batch get log response
	 *
	 * @throws LogException
	 *             if any error happen when get the data from log service server
	 * @throws NullPointerException
	 *             if any parameter is null
	 * @throws IllegalArgumentException
	 *             if project or logstore or cursor is empty
     * @deprecated Please use {@code pullLogs} instead.
	 */
	@Deprecated
    BatchGetLogResponse BatchGetLog(String project, String logStore,
                                    int shardId, int count, String cursor, String end_cursor) throws LogException;

	/**
	 * Batch get log
	 *
	 * @param request
	 *            the batch get log request
	 *
	 * @return batch get log response
	 *
	 * @throws LogException
	 *             if any error happen when get the data from log service server
	 * @throws NullPointerException
	 *             if any parameter is null
	 * @throws IllegalArgumentException
	 *             if project or logstore or cursor in request is empty
     * @deprecated Please use {@code pullLogs} instead.
	 */
	@Deprecated
    BatchGetLogResponse BatchGetLog(BatchGetLogRequest request) throws LogException;

    /**
     * Pull logs from given shard id with cursor.
     *
     * @param request The pull logs request.
     * @return The logs responded.
     * @throws LogException
     */
    PullLogsResponse pullLogs(PullLogsRequest request) throws LogException;

    /**
	 * Create logtail config
	 *
	 * @param project
	 *            the project name
	 * @param config
	 *            the full config resource
	 *
	 * @return the create config response
	 *
	 * @throws LogException
	 *             if any error happen when creating logtail config
	 * @throws NullPointerException
	 *             if config resource parameter is null
	 * @throws IllegalArgumentException
