public BatchPutLogsResponse batchPutLogs()

in src/main/java/com/aliyun/openservices/log/Client.java [666:704]


	public BatchPutLogsResponse batchPutLogs(BatchPutLogsRequest request)
		throws LogException {
		String project = request.GetProject();
		CodingUtils.assertStringNotNullOrEmpty(project, "project");
		CodingUtils.assertStringNotNullOrEmpty(request.getLogStore(), "logStore");
		final CompressType compressType = request.getCompressType();
		CodingUtils.assertParameterNotNull(compressType, "compressType");
		if (compressType != CompressType.ZSTD && compressType != CompressType.LZ4) {
			throw new LogException(ErrorCodes.INVALID_PARAMETER, "Unsupported compress type:" + compressType, "");
		}
		List<LogGroup> logGroups = request.getLogGroups();
		if (logGroups == null || logGroups.isEmpty()) {
			throw new LogException(ErrorCodes.INVALID_PARAMETER, "LogGroups is empty", "");
		}

		byte[] logBytes = request.serializeToPb();
		Map<String, String> headParameter = GetCommonHeadPara(project);
		headParameter.put(Consts.CONST_X_LOG_MODE, Consts.CONST_BATCH_GROUP);
		headParameter.put(Consts.CONST_CONTENT_TYPE, Consts.CONST_PROTO_BUF);
		headParameter.put(Consts.CONST_X_SLS_BODYRAWSIZE, String.valueOf(logBytes.length));
		headParameter.put(Consts.CONST_X_SLS_COMPRESSTYPE, compressType.toString());
		checkBodyRawSize(logBytes.length);
		String resourceUri = "/logstores/" + request.getLogStore();
		String shardKey = request.getHashKey();
		Map<String, String> urlParameter = request.GetAllParams();
		if (shardKey == null || shardKey.isEmpty()) {
			resourceUri += "/shards/lb";
		} else {
			resourceUri += "/shards/route";
			urlParameter.put("key", shardKey);
		}

		ResponseMessage response = sendLogBytes(project, logBytes, resourceUri, urlParameter, headParameter);
		if (response != null) {
			return new BatchPutLogsResponse(response.getHeaders());
		}
		// never happen
		return null;
	}