From 362d5ad801a239ae01b20d16951bc065358b41a8 Mon Sep 17 00:00:00 2001 From: "shuizhao.gh" Date: Mon, 19 Aug 2024 16:54:13 +0800 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20add=20log=20pb=20mod?= =?UTF-8?q?el?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- alibabacloud-gateway-sls/util/main.tea | 29 +++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/alibabacloud-gateway-sls/util/main.tea b/alibabacloud-gateway-sls/util/main.tea index f12c3f20..b86762c8 100644 --- a/alibabacloud-gateway-sls/util/main.tea +++ b/alibabacloud-gateway-sls/util/main.tea @@ -4,4 +4,31 @@ * @param stream the readable stream * @return the parsed result */ -static async function readAndUncompressBlock(stream: readable, compressType: string, bodyRawSize: string): readable \ No newline at end of file +static async function readAndUncompressBlock(stream: readable, compressType: string, bodyRawSize: string): readable + +model LogContent { + key: string(name='key', description='Key of log content'), + value: string(name='value', description='Value of log content') +} + +model LogTag { + key: string(name='key', description='Key of log tag'), + value: string(name='key', description='Value of log tag') +} + +model Log { + time: uint32(name='time', description='Log time, unix timestamp in seconds', example='1724057168'), + contents: [LogContent](name='contents', description='Contents of the log, contains of key/value pair'), + timeNs ?: uint32(name='timeNs', description='Nano part of the log time, between [0, 999999999]', example='123456789') +} + +model LogGroup { + topic ?: string(name='topic', description='Topic of logGroup', example='my-topic'), + source ?: string(name='time', description='Source of logGroup', example='127.0.0.1'), + logs: [Log](name='logs', description='Logs of logGroup'), + logTags ?: [LogTag](name='logTags', description='Tags of logGroup') +} + +model LogGroupList { + logGroupList: [LogGroup] +} From 472ec04671091a4d4c5d64c55ba33587959b0054 Mon Sep 17 00:00:00 2001 From: "shuizhao.gh" Date: Tue, 27 Aug 2024 15:19:45 +0800 Subject: [PATCH 2/4] feat: add java proto --- alibabacloud-gateway-sls/util/java/logs.proto | 30 + alibabacloud-gateway-sls/util/java/pom.xml | 6 + .../com/aliyun/gateway/sls/util/Client.java | 11 + .../gateway/sls/util/model/FastLog.java | 96 + .../sls/util/model/FastLogContent.java | 92 + .../gateway/sls/util/model/FastLogGroup.java | 126 + .../gateway/sls/util/model/FastLogTag.java | 99 + .../gateway/sls/util/model/LogContent.java | 49 + .../gateway/sls/util/model/LogException.java | 20 + .../gateway/sls/util/model/LogItem.java | 128 + .../aliyun/gateway/sls/util/model/LogTag.java | 49 + .../aliyun/gateway/sls/util/model/Logs.java | 4175 +++++++++++++++++ .../util/model/PostLogStoreLogsRequest.java | 146 + .../sls/util/model/PullLogsResponseBody.java | 113 + .../gateway/sls/util/model/VarintUtil.java | 20 + alibabacloud-gateway-sls/util/log.proto | 28 + alibabacloud-gateway-sls/util/main.tea | 34 +- 17 files changed, 5194 insertions(+), 28 deletions(-) create mode 100644 alibabacloud-gateway-sls/util/java/logs.proto create mode 100644 alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/FastLog.java create mode 100644 alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/FastLogContent.java create mode 100644 alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/FastLogGroup.java create mode 100644 alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/FastLogTag.java create mode 100644 alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/LogContent.java create mode 100644 alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/LogException.java create mode 100644 alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/LogItem.java create mode 100644 alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/LogTag.java create mode 100644 alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/Logs.java create mode 100644 alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PostLogStoreLogsRequest.java create mode 100644 alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PullLogsResponseBody.java create mode 100644 alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/VarintUtil.java create mode 100644 alibabacloud-gateway-sls/util/log.proto diff --git a/alibabacloud-gateway-sls/util/java/logs.proto b/alibabacloud-gateway-sls/util/java/logs.proto new file mode 100644 index 00000000..baf3cfe6 --- /dev/null +++ b/alibabacloud-gateway-sls/util/java/logs.proto @@ -0,0 +1,30 @@ +syntax = "proto2"; + +package com.aliyun.gateway.sls.util.model; + +message LogContent +{ + required string Key = 1; + required string Value = 2; +} + +message Log +{ + required uint32 Time = 1; + repeated LogContent Contents= 2; + optional fixed32 TimeNs = 4; +} + +message LogTag +{ + required string Key = 1; + required string Value = 2; +} + +message LogGroup +{ + repeated Log Logs= 1; + optional string Topic = 3; + optional string Source = 4; + repeated LogTag LogTags = 6; +} \ No newline at end of file diff --git a/alibabacloud-gateway-sls/util/java/pom.xml b/alibabacloud-gateway-sls/util/java/pom.xml index 20f80911..a8d33e72 100644 --- a/alibabacloud-gateway-sls/util/java/pom.xml +++ b/alibabacloud-gateway-sls/util/java/pom.xml @@ -51,6 +51,12 @@ lz4 1.3.0 + + + com.google.protobuf + protobuf-java + 3.25.4 + com.aliyun tea diff --git a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/Client.java b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/Client.java index 582ec9fb..d7f3d7bd 100644 --- a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/Client.java +++ b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/Client.java @@ -3,6 +3,10 @@ import java.io.ByteArrayInputStream; import java.io.InputStream; +import java.util.Map; + +import com.aliyun.gateway.sls.util.model.PostLogStoreLogsRequest; +import com.aliyun.gateway.sls.util.model.PullLogsResponseBody; public class Client { @@ -13,4 +17,11 @@ public static InputStream readAndUncompressBlock(InputStream stream, String comp String data = new String(rawData, "UTF-8"); return new ByteArrayInputStream(data.getBytes()); } + public static byte[] SerializeToPbBytes(PostLogStoreLogsRequest request) throws Exception { + return request.serializeToPbBytes(); + } + + public static PullLogsResponseBody DeserializeFromPbBytes(byte[] uncompressedData, int statusCode, Map headers) throws Exception { + return new PullLogsResponseBody(uncompressedData, statusCode, headers); + } } \ No newline at end of file diff --git a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/FastLog.java b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/FastLog.java new file mode 100644 index 00000000..4651a7fe --- /dev/null +++ b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/FastLog.java @@ -0,0 +1,96 @@ +package com.aliyun.gateway.sls.util.model; + +import java.util.ArrayList; +import java.util.List; + +public class FastLog { + + private final byte[] rawBytes; + // [beginOffset, endOffset) + private final int beginOffset; + private final int endOffset; + private final List contents; + private int time = -1; + private int timeNsPart = 0; + + public FastLog(byte[] rawBytes, int offset, int length) { + this.rawBytes = rawBytes; + this.beginOffset = offset; + this.endOffset = offset + length; + this.contents = new ArrayList(); + if (!parse()) { + this.contents.clear(); + } + } + + private boolean parse() { + int pos = this.beginOffset; + int mode, index; + boolean findTime = false; + while (pos < this.endOffset) { + int[] value = VarintUtil.DecodeVarInt32(this.rawBytes, pos, this.endOffset); + if (value[0] == 0) { + return false; + } + mode = value[1] & 0x7; + index = value[1] >> 3; + if (mode == 0) { + pos = value[2]; + value = VarintUtil.DecodeVarInt32(this.rawBytes, pos, this.endOffset); + if (value[0] == 0) { + return false; + } + pos = value[2]; + if (index == 1) { + this.time = value[1]; + findTime = true; + } + } else if (mode == 1) { + pos = value[2] + 8; + } else if (mode == 2) { + pos = value[2]; + value = VarintUtil.DecodeVarInt32(this.rawBytes, pos, this.endOffset); + if (value[0] == 0) { + return false; + } + pos = value[2] + value[1]; + if (index == 2) { + this.contents.add(new FastLogContent(this.rawBytes, value[2], value[1])); + } + } else if (mode == 5) { + if (index == 4) { + timeNsPart = this.rawBytes[value[2]] & 255 | (this.rawBytes[value[2] + 1] & 255) << 8 | (this.rawBytes[value[2] + 2] & 255) << 16 | (this.rawBytes[value[2] + 3] & 255) << 24; + } + pos = value[2] + 4; + } else { + return false; + } + } + return findTime && (pos == this.endOffset); + } + + public int getTime() { + return this.time; + } + + public int getTimeNsPart() { + return this.timeNsPart; + } + + public int getContentsCount() { + return this.contents.size(); + } + + public List getContents() { + return contents; + } + + public FastLogContent getContents(int i) { + if (i < this.contents.size()) { + return this.contents.get(i); + } else { + return null; + } + } + +} diff --git a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/FastLogContent.java b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/FastLogContent.java new file mode 100644 index 00000000..746e22db --- /dev/null +++ b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/FastLogContent.java @@ -0,0 +1,92 @@ +package com.aliyun.gateway.sls.util.model; + +import java.io.UnsupportedEncodingException; + +public class FastLogContent { + + private final byte[] rawBytes; + // [beginOffset, endOffset) + private final int beginOffset; + private final int endOffset; + private int keyOffset = -1; + private int keyLength = -1; + private int valueOffset = -1; + private int valueLength = -1; + + public FastLogContent(byte[] rawBytes, int offset, int length) { + this.rawBytes = rawBytes; + this.beginOffset = offset; + this.endOffset = offset + length; + if (!parse()) { + this.keyOffset = -1; + this.keyLength = -1; + this.valueOffset = -1; + this.valueLength = -1; + } + } + + private boolean parse() { + int pos = this.beginOffset; + int index, mode; + while (pos < this.endOffset) { + int[] value = VarintUtil.DecodeVarInt32(this.rawBytes, pos, this.endOffset); + if (value[0] == 0) { + return false; + } + mode = value[1] & 0x7; + index = value[1] >> 3; + pos = value[2]; + if (mode == 0) { + value = VarintUtil.DecodeVarInt32(this.rawBytes, pos, this.endOffset); + if (value[0] == 0) { + return false; + } + pos = value[2]; + } else if (mode == 1) { + pos += 8; + } else if (mode == 2) { + value = VarintUtil.DecodeVarInt32(this.rawBytes, pos, this.endOffset); + if (value[0] == 0) { + return false; + } + pos = value[2] + value[1]; + if (index == 1) { + keyOffset = value[2]; + keyLength = value[1]; + } else if (index == 2) { + valueOffset = value[2]; + valueLength = value[1]; + } + } else if (mode == 5) { + pos += 4; + } else { + return false; + } + } + return (keyOffset != -1 && valueOffset != -1 && pos == this.endOffset); + } + + public String getKey() { + return decodeString(keyOffset, keyLength); + } + + public String getKey(final String charset) throws UnsupportedEncodingException { + return decodeString(keyOffset, keyLength, charset); + } + + public String getValue() { + return decodeString(valueOffset, valueLength); + } + + public String getValue(final String charset) throws UnsupportedEncodingException { + return decodeString(valueOffset, valueLength, charset); + } + + private String decodeString(int offset, int length) { + return offset < 0 ? null : new String(rawBytes, offset, length); + } + + private String decodeString(int offset, int length, String charset) throws UnsupportedEncodingException { + return offset < 0 ? null : new String(this.rawBytes, offset, length, charset); + } +} diff --git a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/FastLogGroup.java b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/FastLogGroup.java new file mode 100644 index 00000000..9149b80c --- /dev/null +++ b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/FastLogGroup.java @@ -0,0 +1,126 @@ +package com.aliyun.gateway.sls.util.model; + +import java.util.ArrayList; +import java.util.List; + +public class FastLogGroup { + private final byte[] rawBytes; + // [beginOffset, endOffset) + private final int beginOffset; + private final int endOffset; + private final List logs; + private final List tags; + private final String requestId; + private int topicOffset; + private int sourceOffset; + + public FastLogGroup(byte[] rawBytes, int offset, int length, String requestId) { + this.rawBytes = rawBytes; + this.beginOffset = offset; + this.endOffset = offset + length; + this.topicOffset = -1; + this.sourceOffset = -1; + this.logs = new ArrayList(); + this.tags = new ArrayList(); + this.requestId = requestId; + if (!parse()) { + throw new LogException("InitFastLogGroupError", "invalid logGroup data", this.requestId); + } + } + + private boolean parse() { + int pos = this.beginOffset; + int mode, index; + while (pos < this.endOffset) { + int[] value = VarintUtil.DecodeVarInt32(this.rawBytes, pos, this.endOffset); + if (value[0] == 0) { + return false; + } + mode = value[1] & 0x7; + index = value[1] >> 3; + if (mode == 0) { + pos = value[2]; + value = VarintUtil.DecodeVarInt32(this.rawBytes, pos, this.endOffset); + if (value[0] == 0) { + return false; + } + pos = value[2]; + } else if (mode == 1) { + pos = value[2] + 8; + } else if (mode == 2) { + switch (index) { + case 1: + //logs + break; + case 3: + this.topicOffset = value[2]; + break; + case 4: + this.sourceOffset = value[2]; + break; + case 6: + //tags + break; + default: + } + pos = value[2]; + value = VarintUtil.DecodeVarInt32(this.rawBytes, pos, this.endOffset); + if (value[0] == 0) { + return false; + } + pos = value[2] + value[1]; + if (index == 1) { + this.logs.add(new FastLog(this.rawBytes, value[2], value[1])); + } else if (index == 6) { + this.tags.add(new FastLogTag(this.rawBytes, value[2], value[1])); + } + } else if (mode == 5) { + pos = value[2] + 4; + } else { + return false; + } + } + return (pos == this.endOffset); + } + + public int getLogTagsCount() { + return this.tags.size(); + } + + public FastLogTag getLogTags(int i) { + if (i < this.tags.size()) { + return this.tags.get(i); + } else { + return null; + } + } + + public List getLogs() { + return logs; + } + + public List getTags() { + return tags; + } + + public int getLogsCount() { + return this.logs.size(); + } + + public FastLog getLogs(int i) { + if (i < this.logs.size()) { + return this.logs.get(i); + } else { + return null; + } + } + + public boolean hasTopic() { + return this.topicOffset >= 0; + } + + public boolean hasSource() { + return this.sourceOffset >= 0; + } +} + diff --git a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/FastLogTag.java b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/FastLogTag.java new file mode 100644 index 00000000..3144ec31 --- /dev/null +++ b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/FastLogTag.java @@ -0,0 +1,99 @@ +package com.aliyun.gateway.sls.util.model; + +public class FastLogTag { + + private final byte[] rawBytes; + // [beginOffset, endOffset) + private final int beginOffset; + private final int endOffset; + private int keyOffset = -1; + private int keyLength = -1; + private int valueOffset = -1; + private int valueLength = -1; + + public FastLogTag(byte[] rawBytes, int offset, int length) { + this.rawBytes = rawBytes; + this.beginOffset = offset; + this.endOffset = offset + length; + if (!parse()) { + this.keyOffset = -1; + this.keyLength = -1; + this.valueOffset = -1; + this.valueLength = -1; + } + } + + private boolean parse() { + int pos = this.beginOffset; + int mode, index; + while (pos < this.endOffset) { + int[] value = VarintUtil.DecodeVarInt32(this.rawBytes, pos, this.endOffset); + if (value[0] == 0) { + return false; + } + mode = value[1] & 0x7; + index = value[1] >> 3; + pos = value[2]; + if (mode == 0) { + value = VarintUtil.DecodeVarInt32(this.rawBytes, pos, this.endOffset); + if (value[0] == 0) { + return false; + } + pos = value[2]; + } else if (mode == 1) { + pos += 8; + } else if (mode == 2) { + value = VarintUtil.DecodeVarInt32(this.rawBytes, pos, this.endOffset); + if (value[0] == 0) { + return false; + } + pos = value[2] + value[1]; + if (index == 1) { + keyOffset = value[2]; + keyLength = value[1]; + } else if (index == 2) { + valueOffset = value[2]; + valueLength = value[1]; + } + } else if (mode == 5) { + pos += 4; + } else { + return false; + } + } + return (keyOffset != -1 && valueOffset != -1 && pos == this.endOffset); + } + + public String getKey() { + if (this.keyOffset < 0) { + return null; + } + return new String(this.rawBytes, this.keyOffset, this.keyLength); + } + + public String getValue() { + if (this.valueOffset < 0) { + return null; + } + return new String(this.rawBytes, this.valueOffset, this.valueLength); + } + + + public byte[] getKeyBytes() { + if (this.keyOffset < 0) { + return null; + } + byte[] keyBytes = new byte[this.keyLength]; + System.arraycopy(this.rawBytes, this.keyOffset, keyBytes, 0, this.keyLength); + return keyBytes; + } + + public byte[] getValueBytes() { + if (this.valueOffset < 0) { + return null; + } + byte[] valueBytes = new byte[this.valueLength]; + System.arraycopy(this.rawBytes, this.valueOffset, valueBytes, 0, this.valueLength); + return valueBytes; + } +} diff --git a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/LogContent.java b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/LogContent.java new file mode 100644 index 00000000..bf5e0a03 --- /dev/null +++ b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/LogContent.java @@ -0,0 +1,49 @@ +package com.aliyun.gateway.sls.util.model; + +import java.io.Serializable; + +/** + * LogContent is a simple data structure used in @LogItem, it presents a + * key/value pair in @logItem. + * + * @author sls_dev + * + */ +public class LogContent implements Serializable { + private static final long serialVersionUID = 6042186396863898096L; + private final String key; + private final String value; + + /** + * Construct a log content pair + * + * @param key + * log content key + * @param value + * log content value + */ + public LogContent(String key, String value) { + this.key = key; + this.value = value; + } + + + /** + * Get log content key + * + * @return log content key + */ + public String getKey() { + return key; + } + + /** + * Get log content value + * + * @return log content value + */ + public String getValue() { + return value; + } +} + diff --git a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/LogException.java b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/LogException.java new file mode 100644 index 00000000..0c2c652f --- /dev/null +++ b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/LogException.java @@ -0,0 +1,20 @@ +package com.aliyun.gateway.sls.util.model; + +import com.aliyun.tea.TeaConverter; +import com.aliyun.tea.TeaException; +import com.aliyun.tea.TeaPair; + +public class LogException extends TeaException { + public LogException(String code, String message, String requestId, int statusCode) { + super(TeaConverter.buildMap(new TeaPair("code", code), + new TeaPair("message", message), + new TeaPair("data", TeaConverter.buildMap( + new TeaPair("httpCode", statusCode), + new TeaPair("requestId", requestId), + new TeaPair("statusCode", statusCode))))); + } + + public LogException(String code, String message, String requestId) { + this(code, message, requestId, -1); + } +} diff --git a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/LogItem.java b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/LogItem.java new file mode 100644 index 00000000..39e71768 --- /dev/null +++ b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/LogItem.java @@ -0,0 +1,128 @@ +package com.aliyun.gateway.sls.util.model; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + + +/** + * LogItem used to present a log, it contains log time, log source(ip/hostname, + * e.g), and multiple key/value pairs to present the log content + * + * @author sls_dev + */ +public class LogItem implements Serializable { + private static final long serialVersionUID = -3488075856612935955L; + private int time; + private int logTimeNsPart; + private List contents; + + /** + * Construct a logItem, the log time is set according to the sys time + */ + public LogItem() { + this((int) (new Date().getTime() / 1000)); + } + + /** + * Construct a logItem with a certain time stamp + * + * @param time log time stamp + */ + public LogItem(int time) { + this(time, new ArrayList()); + } + + /** + * Construct a logItem with a certain time stamp and log contents + * + * @param time log time stamp + * @param contents log contents + */ + public LogItem(int time, List contents) { + this(time, -1, contents); + } + + /** + * Construct a logItem with a certain time stamp and log contents + * + * @param time log time stamp + * @param logTimeNsPart log time nano stamp + * @param contents log contents + */ + public LogItem(int time, int logTimeNsPart, List contents) { + this.time = time; + this.logTimeNsPart = logTimeNsPart; + this.contents = contents; + } + + /** + * Get log time + * + * @return log time + */ + public int getTime() { + return time; + } + + /** + * Set logTime + * + * @param logTime log time + */ + public void setTime(int logTime) { + this.time = logTime; + } + + /** + * Get log timeNsPart + * + * @return log time ns part + */ + public int getTimeNsPart() { + return logTimeNsPart; + } + + public boolean hasTimeNsPart() { + return logTimeNsPart != -1; + } + + /** + * Set logTimeNsPart + * + * @param logTimeNsPart log time ns part + */ + public void setTimeNsPart(int logTimeNsPart) { + this.logTimeNsPart = logTimeNsPart; + } + + /** + * Add a log content key/value pair to the log + * + * @param key log content key + * @param value log content value + */ + public void pushBack(String key, String value) { + contents.add(new LogContent(key, value)); + } + + /** + * Get log contents + * + * @return log contents + */ + public List getLogContents() { + return contents; + } + + /** + * set log contents + * + * @param contents log contents + */ + public void setLogContents(List contents) { + this.contents = contents; + } + +} diff --git a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/LogTag.java b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/LogTag.java new file mode 100644 index 00000000..eafb1f34 --- /dev/null +++ b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/LogTag.java @@ -0,0 +1,49 @@ +package com.aliyun.gateway.sls.util.model; + +import java.io.Serializable; + +/** + * LogContent is a simple data structure used in @LogItem, it presents a + * key/value pair in @logItem. + * + * @author sls_dev + * + */ +public class LogTag implements Serializable { + + private static final long serialVersionUID = 2417167614162708776L; + private final String key; + private final String value; + + /** + * Construct a log content pair + * + * @param key + * log content key + * @param value + * log content value + */ + public LogTag(String key, String value) { + this.key = key; + this.value = value; + } + + /** + * Get log tag key + * + * @return log tag key + */ + public String getKey() { + return this.key; + } + + /** + * Get log content value + * + * @return log content value + */ + public String getValue() { + return this.value; + } +} + diff --git a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/Logs.java b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/Logs.java new file mode 100644 index 00000000..f33fa124 --- /dev/null +++ b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/Logs.java @@ -0,0 +1,4175 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: logs.proto + +// Protobuf Java Version: 3.25.1 +package com.aliyun.gateway.sls.util.model; + +public final class Logs { + private Logs() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + public interface LogContentOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.aliyun.gateway.sls.util.model.LogContent) + com.google.protobuf.MessageOrBuilder { + + /** + * required string Key = 1; + * @return Whether the key field is set. + */ + boolean hasKey(); + /** + * required string Key = 1; + * @return The key. + */ + java.lang.String getKey(); + /** + * required string Key = 1; + * @return The bytes for key. + */ + com.google.protobuf.ByteString + getKeyBytes(); + + /** + * required string Value = 2; + * @return Whether the value field is set. + */ + boolean hasValue(); + /** + * required string Value = 2; + * @return The value. + */ + java.lang.String getValue(); + /** + * required string Value = 2; + * @return The bytes for value. + */ + com.google.protobuf.ByteString + getValueBytes(); + } + /** + * Protobuf type {@code com.aliyun.gateway.sls.util.model.LogContent} + */ + public static final class LogContent extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.aliyun.gateway.sls.util.model.LogContent) + LogContentOrBuilder { + private static final long serialVersionUID = 0L; + // Use LogContent.newBuilder() to construct. + private LogContent(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private LogContent() { + key_ = ""; + value_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new LogContent(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.aliyun.gateway.sls.util.model.Logs.internal_static_com_aliyun_gateway_sls_util_model_LogContent_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.aliyun.gateway.sls.util.model.Logs.internal_static_com_aliyun_gateway_sls_util_model_LogContent_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.aliyun.gateway.sls.util.model.Logs.LogContent.class, com.aliyun.gateway.sls.util.model.Logs.LogContent.Builder.class); + } + + private int bitField0_; + public static final int KEY_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object key_ = ""; + /** + * required string Key = 1; + * @return Whether the key field is set. + */ + @java.lang.Override + public boolean hasKey() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * required string Key = 1; + * @return The key. + */ + @java.lang.Override + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + key_ = s; + } + return s; + } + } + /** + * required string Key = 1; + * @return The bytes for key. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int VALUE_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object value_ = ""; + /** + * required string Value = 2; + * @return Whether the value field is set. + */ + @java.lang.Override + public boolean hasValue() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * required string Value = 2; + * @return The value. + */ + @java.lang.Override + public java.lang.String getValue() { + java.lang.Object ref = value_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + value_ = s; + } + return s; + } + } + /** + * required string Value = 2; + * @return The bytes for value. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getValueBytes() { + java.lang.Object ref = value_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + value_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + if (!hasKey()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasValue()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, key_); + } + if (((bitField0_ & 0x00000002) != 0)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, value_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, key_); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, value_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.aliyun.gateway.sls.util.model.Logs.LogContent)) { + return super.equals(obj); + } + com.aliyun.gateway.sls.util.model.Logs.LogContent other = (com.aliyun.gateway.sls.util.model.Logs.LogContent) obj; + + if (hasKey() != other.hasKey()) return false; + if (hasKey()) { + if (!getKey() + .equals(other.getKey())) return false; + } + if (hasValue() != other.hasValue()) return false; + if (hasValue()) { + if (!getValue() + .equals(other.getValue())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasKey()) { + hash = (37 * hash) + KEY_FIELD_NUMBER; + hash = (53 * hash) + getKey().hashCode(); + } + if (hasValue()) { + hash = (37 * hash) + VALUE_FIELD_NUMBER; + hash = (53 * hash) + getValue().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.aliyun.gateway.sls.util.model.Logs.LogContent parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.aliyun.gateway.sls.util.model.Logs.LogContent parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.model.Logs.LogContent parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.aliyun.gateway.sls.util.model.Logs.LogContent parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.model.Logs.LogContent parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.aliyun.gateway.sls.util.model.Logs.LogContent parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.model.Logs.LogContent parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.aliyun.gateway.sls.util.model.Logs.LogContent parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static com.aliyun.gateway.sls.util.model.Logs.LogContent parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + + public static com.aliyun.gateway.sls.util.model.Logs.LogContent parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.model.Logs.LogContent parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.aliyun.gateway.sls.util.model.Logs.LogContent parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.aliyun.gateway.sls.util.model.Logs.LogContent prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code com.aliyun.gateway.sls.util.model.LogContent} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:com.aliyun.gateway.sls.util.model.LogContent) + com.aliyun.gateway.sls.util.model.Logs.LogContentOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.aliyun.gateway.sls.util.model.Logs.internal_static_com_aliyun_gateway_sls_util_model_LogContent_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.aliyun.gateway.sls.util.model.Logs.internal_static_com_aliyun_gateway_sls_util_model_LogContent_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.aliyun.gateway.sls.util.model.Logs.LogContent.class, com.aliyun.gateway.sls.util.model.Logs.LogContent.Builder.class); + } + + // Construct using com.aliyun.gateway.sls.util.model.Logs.LogContent.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + key_ = ""; + value_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.aliyun.gateway.sls.util.model.Logs.internal_static_com_aliyun_gateway_sls_util_model_LogContent_descriptor; + } + + @java.lang.Override + public com.aliyun.gateway.sls.util.model.Logs.LogContent getDefaultInstanceForType() { + return com.aliyun.gateway.sls.util.model.Logs.LogContent.getDefaultInstance(); + } + + @java.lang.Override + public com.aliyun.gateway.sls.util.model.Logs.LogContent build() { + com.aliyun.gateway.sls.util.model.Logs.LogContent result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.aliyun.gateway.sls.util.model.Logs.LogContent buildPartial() { + com.aliyun.gateway.sls.util.model.Logs.LogContent result = new com.aliyun.gateway.sls.util.model.Logs.LogContent(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(com.aliyun.gateway.sls.util.model.Logs.LogContent result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.key_ = key_; + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.value_ = value_; + to_bitField0_ |= 0x00000002; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.aliyun.gateway.sls.util.model.Logs.LogContent) { + return mergeFrom((com.aliyun.gateway.sls.util.model.Logs.LogContent)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.aliyun.gateway.sls.util.model.Logs.LogContent other) { + if (other == com.aliyun.gateway.sls.util.model.Logs.LogContent.getDefaultInstance()) return this; + if (other.hasKey()) { + key_ = other.key_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (other.hasValue()) { + value_ = other.value_; + bitField0_ |= 0x00000002; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + if (!hasKey()) { + return false; + } + if (!hasValue()) { + return false; + } + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + key_ = input.readBytes(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + value_ = input.readBytes(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object key_ = ""; + /** + * required string Key = 1; + * @return Whether the key field is set. + */ + public boolean hasKey() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * required string Key = 1; + * @return The key. + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + key_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * required string Key = 1; + * @return The bytes for key. + */ + public com.google.protobuf.ByteString + getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * required string Key = 1; + * @param value The key to set. + * @return This builder for chaining. + */ + public Builder setKey( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + key_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * required string Key = 1; + * @return This builder for chaining. + */ + public Builder clearKey() { + key_ = getDefaultInstance().getKey(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * required string Key = 1; + * @param value The bytes for key to set. + * @return This builder for chaining. + */ + public Builder setKeyBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + key_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object value_ = ""; + /** + * required string Value = 2; + * @return Whether the value field is set. + */ + public boolean hasValue() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * required string Value = 2; + * @return The value. + */ + public java.lang.String getValue() { + java.lang.Object ref = value_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + value_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * required string Value = 2; + * @return The bytes for value. + */ + public com.google.protobuf.ByteString + getValueBytes() { + java.lang.Object ref = value_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + value_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * required string Value = 2; + * @param value The value to set. + * @return This builder for chaining. + */ + public Builder setValue( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + value_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * required string Value = 2; + * @return This builder for chaining. + */ + public Builder clearValue() { + value_ = getDefaultInstance().getValue(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * required string Value = 2; + * @param value The bytes for value to set. + * @return This builder for chaining. + */ + public Builder setValueBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + value_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.aliyun.gateway.sls.util.model.LogContent) + } + + // @@protoc_insertion_point(class_scope:com.aliyun.gateway.sls.util.model.LogContent) + private static final com.aliyun.gateway.sls.util.model.Logs.LogContent DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.aliyun.gateway.sls.util.model.Logs.LogContent(); + } + + public static com.aliyun.gateway.sls.util.model.Logs.LogContent getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + @java.lang.Deprecated public static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public LogContent parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.aliyun.gateway.sls.util.model.Logs.LogContent getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface LogOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.aliyun.gateway.sls.util.model.Log) + com.google.protobuf.MessageOrBuilder { + + /** + * required uint32 Time = 1; + * @return Whether the time field is set. + */ + boolean hasTime(); + /** + * required uint32 Time = 1; + * @return The time. + */ + int getTime(); + + /** + * repeated .com.aliyun.gateway.sls.util.model.LogContent Contents = 2; + */ + java.util.List + getContentsList(); + /** + * repeated .com.aliyun.gateway.sls.util.model.LogContent Contents = 2; + */ + com.aliyun.gateway.sls.util.model.Logs.LogContent getContents(int index); + /** + * repeated .com.aliyun.gateway.sls.util.model.LogContent Contents = 2; + */ + int getContentsCount(); + /** + * repeated .com.aliyun.gateway.sls.util.model.LogContent Contents = 2; + */ + java.util.List + getContentsOrBuilderList(); + /** + * repeated .com.aliyun.gateway.sls.util.model.LogContent Contents = 2; + */ + com.aliyun.gateway.sls.util.model.Logs.LogContentOrBuilder getContentsOrBuilder( + int index); + + /** + * optional fixed32 TimeNs = 4; + * @return Whether the timeNs field is set. + */ + boolean hasTimeNs(); + /** + * optional fixed32 TimeNs = 4; + * @return The timeNs. + */ + int getTimeNs(); + } + /** + * Protobuf type {@code com.aliyun.gateway.sls.util.model.Log} + */ + public static final class Log extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.aliyun.gateway.sls.util.model.Log) + LogOrBuilder { + private static final long serialVersionUID = 0L; + // Use Log.newBuilder() to construct. + private Log(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Log() { + contents_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new Log(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.aliyun.gateway.sls.util.model.Logs.internal_static_com_aliyun_gateway_sls_util_model_Log_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.aliyun.gateway.sls.util.model.Logs.internal_static_com_aliyun_gateway_sls_util_model_Log_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.aliyun.gateway.sls.util.model.Logs.Log.class, com.aliyun.gateway.sls.util.model.Logs.Log.Builder.class); + } + + private int bitField0_; + public static final int TIME_FIELD_NUMBER = 1; + private int time_ = 0; + /** + * required uint32 Time = 1; + * @return Whether the time field is set. + */ + @java.lang.Override + public boolean hasTime() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * required uint32 Time = 1; + * @return The time. + */ + @java.lang.Override + public int getTime() { + return time_; + } + + public static final int CONTENTS_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private java.util.List contents_; + /** + * repeated .com.aliyun.gateway.sls.util.model.LogContent Contents = 2; + */ + @java.lang.Override + public java.util.List getContentsList() { + return contents_; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogContent Contents = 2; + */ + @java.lang.Override + public java.util.List + getContentsOrBuilderList() { + return contents_; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogContent Contents = 2; + */ + @java.lang.Override + public int getContentsCount() { + return contents_.size(); + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogContent Contents = 2; + */ + @java.lang.Override + public com.aliyun.gateway.sls.util.model.Logs.LogContent getContents(int index) { + return contents_.get(index); + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogContent Contents = 2; + */ + @java.lang.Override + public com.aliyun.gateway.sls.util.model.Logs.LogContentOrBuilder getContentsOrBuilder( + int index) { + return contents_.get(index); + } + + public static final int TIMENS_FIELD_NUMBER = 4; + private int timeNs_ = 0; + /** + * optional fixed32 TimeNs = 4; + * @return Whether the timeNs field is set. + */ + @java.lang.Override + public boolean hasTimeNs() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * optional fixed32 TimeNs = 4; + * @return The timeNs. + */ + @java.lang.Override + public int getTimeNs() { + return timeNs_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + if (!hasTime()) { + memoizedIsInitialized = 0; + return false; + } + for (int i = 0; i < getContentsCount(); i++) { + if (!getContents(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + output.writeUInt32(1, time_); + } + for (int i = 0; i < contents_.size(); i++) { + output.writeMessage(2, contents_.get(i)); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeFixed32(4, timeNs_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(1, time_); + } + for (int i = 0; i < contents_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, contents_.get(i)); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeFixed32Size(4, timeNs_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.aliyun.gateway.sls.util.model.Logs.Log)) { + return super.equals(obj); + } + com.aliyun.gateway.sls.util.model.Logs.Log other = (com.aliyun.gateway.sls.util.model.Logs.Log) obj; + + if (hasTime() != other.hasTime()) return false; + if (hasTime()) { + if (getTime() + != other.getTime()) return false; + } + if (!getContentsList() + .equals(other.getContentsList())) return false; + if (hasTimeNs() != other.hasTimeNs()) return false; + if (hasTimeNs()) { + if (getTimeNs() + != other.getTimeNs()) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasTime()) { + hash = (37 * hash) + TIME_FIELD_NUMBER; + hash = (53 * hash) + getTime(); + } + if (getContentsCount() > 0) { + hash = (37 * hash) + CONTENTS_FIELD_NUMBER; + hash = (53 * hash) + getContentsList().hashCode(); + } + if (hasTimeNs()) { + hash = (37 * hash) + TIMENS_FIELD_NUMBER; + hash = (53 * hash) + getTimeNs(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.aliyun.gateway.sls.util.model.Logs.Log parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.aliyun.gateway.sls.util.model.Logs.Log parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.model.Logs.Log parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.aliyun.gateway.sls.util.model.Logs.Log parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.model.Logs.Log parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.aliyun.gateway.sls.util.model.Logs.Log parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.model.Logs.Log parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.aliyun.gateway.sls.util.model.Logs.Log parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static com.aliyun.gateway.sls.util.model.Logs.Log parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + + public static com.aliyun.gateway.sls.util.model.Logs.Log parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.model.Logs.Log parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.aliyun.gateway.sls.util.model.Logs.Log parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.aliyun.gateway.sls.util.model.Logs.Log prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code com.aliyun.gateway.sls.util.model.Log} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:com.aliyun.gateway.sls.util.model.Log) + com.aliyun.gateway.sls.util.model.Logs.LogOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.aliyun.gateway.sls.util.model.Logs.internal_static_com_aliyun_gateway_sls_util_model_Log_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.aliyun.gateway.sls.util.model.Logs.internal_static_com_aliyun_gateway_sls_util_model_Log_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.aliyun.gateway.sls.util.model.Logs.Log.class, com.aliyun.gateway.sls.util.model.Logs.Log.Builder.class); + } + + // Construct using com.aliyun.gateway.sls.util.model.Logs.Log.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + time_ = 0; + if (contentsBuilder_ == null) { + contents_ = java.util.Collections.emptyList(); + } else { + contents_ = null; + contentsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + timeNs_ = 0; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.aliyun.gateway.sls.util.model.Logs.internal_static_com_aliyun_gateway_sls_util_model_Log_descriptor; + } + + @java.lang.Override + public com.aliyun.gateway.sls.util.model.Logs.Log getDefaultInstanceForType() { + return com.aliyun.gateway.sls.util.model.Logs.Log.getDefaultInstance(); + } + + @java.lang.Override + public com.aliyun.gateway.sls.util.model.Logs.Log build() { + com.aliyun.gateway.sls.util.model.Logs.Log result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.aliyun.gateway.sls.util.model.Logs.Log buildPartial() { + com.aliyun.gateway.sls.util.model.Logs.Log result = new com.aliyun.gateway.sls.util.model.Logs.Log(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(com.aliyun.gateway.sls.util.model.Logs.Log result) { + if (contentsBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0)) { + contents_ = java.util.Collections.unmodifiableList(contents_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.contents_ = contents_; + } else { + result.contents_ = contentsBuilder_.build(); + } + } + + private void buildPartial0(com.aliyun.gateway.sls.util.model.Logs.Log result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.time_ = time_; + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.timeNs_ = timeNs_; + to_bitField0_ |= 0x00000002; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.aliyun.gateway.sls.util.model.Logs.Log) { + return mergeFrom((com.aliyun.gateway.sls.util.model.Logs.Log)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.aliyun.gateway.sls.util.model.Logs.Log other) { + if (other == com.aliyun.gateway.sls.util.model.Logs.Log.getDefaultInstance()) return this; + if (other.hasTime()) { + setTime(other.getTime()); + } + if (contentsBuilder_ == null) { + if (!other.contents_.isEmpty()) { + if (contents_.isEmpty()) { + contents_ = other.contents_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureContentsIsMutable(); + contents_.addAll(other.contents_); + } + onChanged(); + } + } else { + if (!other.contents_.isEmpty()) { + if (contentsBuilder_.isEmpty()) { + contentsBuilder_.dispose(); + contentsBuilder_ = null; + contents_ = other.contents_; + bitField0_ = (bitField0_ & ~0x00000002); + contentsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + getContentsFieldBuilder() : null; + } else { + contentsBuilder_.addAllMessages(other.contents_); + } + } + } + if (other.hasTimeNs()) { + setTimeNs(other.getTimeNs()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + if (!hasTime()) { + return false; + } + for (int i = 0; i < getContentsCount(); i++) { + if (!getContents(i).isInitialized()) { + return false; + } + } + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + time_ = input.readUInt32(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 18: { + com.aliyun.gateway.sls.util.model.Logs.LogContent m = + input.readMessage( + com.aliyun.gateway.sls.util.model.Logs.LogContent.PARSER, + extensionRegistry); + if (contentsBuilder_ == null) { + ensureContentsIsMutable(); + contents_.add(m); + } else { + contentsBuilder_.addMessage(m); + } + break; + } // case 18 + case 37: { + timeNs_ = input.readFixed32(); + bitField0_ |= 0x00000004; + break; + } // case 37 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private int time_ ; + /** + * required uint32 Time = 1; + * @return Whether the time field is set. + */ + @java.lang.Override + public boolean hasTime() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * required uint32 Time = 1; + * @return The time. + */ + @java.lang.Override + public int getTime() { + return time_; + } + /** + * required uint32 Time = 1; + * @param value The time to set. + * @return This builder for chaining. + */ + public Builder setTime(int value) { + + time_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * required uint32 Time = 1; + * @return This builder for chaining. + */ + public Builder clearTime() { + bitField0_ = (bitField0_ & ~0x00000001); + time_ = 0; + onChanged(); + return this; + } + + private java.util.List contents_ = + java.util.Collections.emptyList(); + private void ensureContentsIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + contents_ = new java.util.ArrayList(contents_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.aliyun.gateway.sls.util.model.Logs.LogContent, com.aliyun.gateway.sls.util.model.Logs.LogContent.Builder, com.aliyun.gateway.sls.util.model.Logs.LogContentOrBuilder> contentsBuilder_; + + /** + * repeated .com.aliyun.gateway.sls.util.model.LogContent Contents = 2; + */ + public java.util.List getContentsList() { + if (contentsBuilder_ == null) { + return java.util.Collections.unmodifiableList(contents_); + } else { + return contentsBuilder_.getMessageList(); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogContent Contents = 2; + */ + public int getContentsCount() { + if (contentsBuilder_ == null) { + return contents_.size(); + } else { + return contentsBuilder_.getCount(); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogContent Contents = 2; + */ + public com.aliyun.gateway.sls.util.model.Logs.LogContent getContents(int index) { + if (contentsBuilder_ == null) { + return contents_.get(index); + } else { + return contentsBuilder_.getMessage(index); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogContent Contents = 2; + */ + public Builder setContents( + int index, com.aliyun.gateway.sls.util.model.Logs.LogContent value) { + if (contentsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureContentsIsMutable(); + contents_.set(index, value); + onChanged(); + } else { + contentsBuilder_.setMessage(index, value); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogContent Contents = 2; + */ + public Builder setContents( + int index, com.aliyun.gateway.sls.util.model.Logs.LogContent.Builder builderForValue) { + if (contentsBuilder_ == null) { + ensureContentsIsMutable(); + contents_.set(index, builderForValue.build()); + onChanged(); + } else { + contentsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogContent Contents = 2; + */ + public Builder addContents(com.aliyun.gateway.sls.util.model.Logs.LogContent value) { + if (contentsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureContentsIsMutable(); + contents_.add(value); + onChanged(); + } else { + contentsBuilder_.addMessage(value); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogContent Contents = 2; + */ + public Builder addContents( + int index, com.aliyun.gateway.sls.util.model.Logs.LogContent value) { + if (contentsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureContentsIsMutable(); + contents_.add(index, value); + onChanged(); + } else { + contentsBuilder_.addMessage(index, value); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogContent Contents = 2; + */ + public Builder addContents( + com.aliyun.gateway.sls.util.model.Logs.LogContent.Builder builderForValue) { + if (contentsBuilder_ == null) { + ensureContentsIsMutable(); + contents_.add(builderForValue.build()); + onChanged(); + } else { + contentsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogContent Contents = 2; + */ + public Builder addContents( + int index, com.aliyun.gateway.sls.util.model.Logs.LogContent.Builder builderForValue) { + if (contentsBuilder_ == null) { + ensureContentsIsMutable(); + contents_.add(index, builderForValue.build()); + onChanged(); + } else { + contentsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogContent Contents = 2; + */ + public Builder addAllContents( + java.lang.Iterable values) { + if (contentsBuilder_ == null) { + ensureContentsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, contents_); + onChanged(); + } else { + contentsBuilder_.addAllMessages(values); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogContent Contents = 2; + */ + public Builder clearContents() { + if (contentsBuilder_ == null) { + contents_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + contentsBuilder_.clear(); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogContent Contents = 2; + */ + public Builder removeContents(int index) { + if (contentsBuilder_ == null) { + ensureContentsIsMutable(); + contents_.remove(index); + onChanged(); + } else { + contentsBuilder_.remove(index); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogContent Contents = 2; + */ + public com.aliyun.gateway.sls.util.model.Logs.LogContent.Builder getContentsBuilder( + int index) { + return getContentsFieldBuilder().getBuilder(index); + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogContent Contents = 2; + */ + public com.aliyun.gateway.sls.util.model.Logs.LogContentOrBuilder getContentsOrBuilder( + int index) { + if (contentsBuilder_ == null) { + return contents_.get(index); } else { + return contentsBuilder_.getMessageOrBuilder(index); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogContent Contents = 2; + */ + public java.util.List + getContentsOrBuilderList() { + if (contentsBuilder_ != null) { + return contentsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(contents_); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogContent Contents = 2; + */ + public com.aliyun.gateway.sls.util.model.Logs.LogContent.Builder addContentsBuilder() { + return getContentsFieldBuilder().addBuilder( + com.aliyun.gateway.sls.util.model.Logs.LogContent.getDefaultInstance()); + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogContent Contents = 2; + */ + public com.aliyun.gateway.sls.util.model.Logs.LogContent.Builder addContentsBuilder( + int index) { + return getContentsFieldBuilder().addBuilder( + index, com.aliyun.gateway.sls.util.model.Logs.LogContent.getDefaultInstance()); + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogContent Contents = 2; + */ + public java.util.List + getContentsBuilderList() { + return getContentsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilderV3< + com.aliyun.gateway.sls.util.model.Logs.LogContent, com.aliyun.gateway.sls.util.model.Logs.LogContent.Builder, com.aliyun.gateway.sls.util.model.Logs.LogContentOrBuilder> + getContentsFieldBuilder() { + if (contentsBuilder_ == null) { + contentsBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + com.aliyun.gateway.sls.util.model.Logs.LogContent, com.aliyun.gateway.sls.util.model.Logs.LogContent.Builder, com.aliyun.gateway.sls.util.model.Logs.LogContentOrBuilder>( + contents_, + ((bitField0_ & 0x00000002) != 0), + getParentForChildren(), + isClean()); + contents_ = null; + } + return contentsBuilder_; + } + + private int timeNs_ ; + /** + * optional fixed32 TimeNs = 4; + * @return Whether the timeNs field is set. + */ + @java.lang.Override + public boolean hasTimeNs() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * optional fixed32 TimeNs = 4; + * @return The timeNs. + */ + @java.lang.Override + public int getTimeNs() { + return timeNs_; + } + /** + * optional fixed32 TimeNs = 4; + * @param value The timeNs to set. + * @return This builder for chaining. + */ + public Builder setTimeNs(int value) { + + timeNs_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * optional fixed32 TimeNs = 4; + * @return This builder for chaining. + */ + public Builder clearTimeNs() { + bitField0_ = (bitField0_ & ~0x00000004); + timeNs_ = 0; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.aliyun.gateway.sls.util.model.Log) + } + + // @@protoc_insertion_point(class_scope:com.aliyun.gateway.sls.util.model.Log) + private static final com.aliyun.gateway.sls.util.model.Logs.Log DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.aliyun.gateway.sls.util.model.Logs.Log(); + } + + public static com.aliyun.gateway.sls.util.model.Logs.Log getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + @java.lang.Deprecated public static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Log parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.aliyun.gateway.sls.util.model.Logs.Log getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface LogTagOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.aliyun.gateway.sls.util.model.LogTag) + com.google.protobuf.MessageOrBuilder { + + /** + * required string Key = 1; + * @return Whether the key field is set. + */ + boolean hasKey(); + /** + * required string Key = 1; + * @return The key. + */ + java.lang.String getKey(); + /** + * required string Key = 1; + * @return The bytes for key. + */ + com.google.protobuf.ByteString + getKeyBytes(); + + /** + * required string Value = 2; + * @return Whether the value field is set. + */ + boolean hasValue(); + /** + * required string Value = 2; + * @return The value. + */ + java.lang.String getValue(); + /** + * required string Value = 2; + * @return The bytes for value. + */ + com.google.protobuf.ByteString + getValueBytes(); + } + /** + * Protobuf type {@code com.aliyun.gateway.sls.util.model.LogTag} + */ + public static final class LogTag extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.aliyun.gateway.sls.util.model.LogTag) + LogTagOrBuilder { + private static final long serialVersionUID = 0L; + // Use LogTag.newBuilder() to construct. + private LogTag(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private LogTag() { + key_ = ""; + value_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new LogTag(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.aliyun.gateway.sls.util.model.Logs.internal_static_com_aliyun_gateway_sls_util_model_LogTag_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.aliyun.gateway.sls.util.model.Logs.internal_static_com_aliyun_gateway_sls_util_model_LogTag_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.aliyun.gateway.sls.util.model.Logs.LogTag.class, com.aliyun.gateway.sls.util.model.Logs.LogTag.Builder.class); + } + + private int bitField0_; + public static final int KEY_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object key_ = ""; + /** + * required string Key = 1; + * @return Whether the key field is set. + */ + @java.lang.Override + public boolean hasKey() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * required string Key = 1; + * @return The key. + */ + @java.lang.Override + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + key_ = s; + } + return s; + } + } + /** + * required string Key = 1; + * @return The bytes for key. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int VALUE_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object value_ = ""; + /** + * required string Value = 2; + * @return Whether the value field is set. + */ + @java.lang.Override + public boolean hasValue() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * required string Value = 2; + * @return The value. + */ + @java.lang.Override + public java.lang.String getValue() { + java.lang.Object ref = value_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + value_ = s; + } + return s; + } + } + /** + * required string Value = 2; + * @return The bytes for value. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getValueBytes() { + java.lang.Object ref = value_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + value_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + if (!hasKey()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasValue()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, key_); + } + if (((bitField0_ & 0x00000002) != 0)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, value_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, key_); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, value_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.aliyun.gateway.sls.util.model.Logs.LogTag)) { + return super.equals(obj); + } + com.aliyun.gateway.sls.util.model.Logs.LogTag other = (com.aliyun.gateway.sls.util.model.Logs.LogTag) obj; + + if (hasKey() != other.hasKey()) return false; + if (hasKey()) { + if (!getKey() + .equals(other.getKey())) return false; + } + if (hasValue() != other.hasValue()) return false; + if (hasValue()) { + if (!getValue() + .equals(other.getValue())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasKey()) { + hash = (37 * hash) + KEY_FIELD_NUMBER; + hash = (53 * hash) + getKey().hashCode(); + } + if (hasValue()) { + hash = (37 * hash) + VALUE_FIELD_NUMBER; + hash = (53 * hash) + getValue().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.aliyun.gateway.sls.util.model.Logs.LogTag parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.aliyun.gateway.sls.util.model.Logs.LogTag parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.model.Logs.LogTag parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.aliyun.gateway.sls.util.model.Logs.LogTag parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.model.Logs.LogTag parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.aliyun.gateway.sls.util.model.Logs.LogTag parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.model.Logs.LogTag parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.aliyun.gateway.sls.util.model.Logs.LogTag parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static com.aliyun.gateway.sls.util.model.Logs.LogTag parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + + public static com.aliyun.gateway.sls.util.model.Logs.LogTag parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.model.Logs.LogTag parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.aliyun.gateway.sls.util.model.Logs.LogTag parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.aliyun.gateway.sls.util.model.Logs.LogTag prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code com.aliyun.gateway.sls.util.model.LogTag} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:com.aliyun.gateway.sls.util.model.LogTag) + com.aliyun.gateway.sls.util.model.Logs.LogTagOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.aliyun.gateway.sls.util.model.Logs.internal_static_com_aliyun_gateway_sls_util_model_LogTag_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.aliyun.gateway.sls.util.model.Logs.internal_static_com_aliyun_gateway_sls_util_model_LogTag_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.aliyun.gateway.sls.util.model.Logs.LogTag.class, com.aliyun.gateway.sls.util.model.Logs.LogTag.Builder.class); + } + + // Construct using com.aliyun.gateway.sls.util.model.Logs.LogTag.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + key_ = ""; + value_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.aliyun.gateway.sls.util.model.Logs.internal_static_com_aliyun_gateway_sls_util_model_LogTag_descriptor; + } + + @java.lang.Override + public com.aliyun.gateway.sls.util.model.Logs.LogTag getDefaultInstanceForType() { + return com.aliyun.gateway.sls.util.model.Logs.LogTag.getDefaultInstance(); + } + + @java.lang.Override + public com.aliyun.gateway.sls.util.model.Logs.LogTag build() { + com.aliyun.gateway.sls.util.model.Logs.LogTag result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.aliyun.gateway.sls.util.model.Logs.LogTag buildPartial() { + com.aliyun.gateway.sls.util.model.Logs.LogTag result = new com.aliyun.gateway.sls.util.model.Logs.LogTag(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(com.aliyun.gateway.sls.util.model.Logs.LogTag result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.key_ = key_; + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.value_ = value_; + to_bitField0_ |= 0x00000002; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.aliyun.gateway.sls.util.model.Logs.LogTag) { + return mergeFrom((com.aliyun.gateway.sls.util.model.Logs.LogTag)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.aliyun.gateway.sls.util.model.Logs.LogTag other) { + if (other == com.aliyun.gateway.sls.util.model.Logs.LogTag.getDefaultInstance()) return this; + if (other.hasKey()) { + key_ = other.key_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (other.hasValue()) { + value_ = other.value_; + bitField0_ |= 0x00000002; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + if (!hasKey()) { + return false; + } + if (!hasValue()) { + return false; + } + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + key_ = input.readBytes(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + value_ = input.readBytes(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object key_ = ""; + /** + * required string Key = 1; + * @return Whether the key field is set. + */ + public boolean hasKey() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * required string Key = 1; + * @return The key. + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + key_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * required string Key = 1; + * @return The bytes for key. + */ + public com.google.protobuf.ByteString + getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * required string Key = 1; + * @param value The key to set. + * @return This builder for chaining. + */ + public Builder setKey( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + key_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * required string Key = 1; + * @return This builder for chaining. + */ + public Builder clearKey() { + key_ = getDefaultInstance().getKey(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * required string Key = 1; + * @param value The bytes for key to set. + * @return This builder for chaining. + */ + public Builder setKeyBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + key_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object value_ = ""; + /** + * required string Value = 2; + * @return Whether the value field is set. + */ + public boolean hasValue() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * required string Value = 2; + * @return The value. + */ + public java.lang.String getValue() { + java.lang.Object ref = value_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + value_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * required string Value = 2; + * @return The bytes for value. + */ + public com.google.protobuf.ByteString + getValueBytes() { + java.lang.Object ref = value_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + value_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * required string Value = 2; + * @param value The value to set. + * @return This builder for chaining. + */ + public Builder setValue( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + value_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * required string Value = 2; + * @return This builder for chaining. + */ + public Builder clearValue() { + value_ = getDefaultInstance().getValue(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * required string Value = 2; + * @param value The bytes for value to set. + * @return This builder for chaining. + */ + public Builder setValueBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + value_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.aliyun.gateway.sls.util.model.LogTag) + } + + // @@protoc_insertion_point(class_scope:com.aliyun.gateway.sls.util.model.LogTag) + private static final com.aliyun.gateway.sls.util.model.Logs.LogTag DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.aliyun.gateway.sls.util.model.Logs.LogTag(); + } + + public static com.aliyun.gateway.sls.util.model.Logs.LogTag getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + @java.lang.Deprecated public static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public LogTag parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.aliyun.gateway.sls.util.model.Logs.LogTag getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface LogGroupOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.aliyun.gateway.sls.util.model.LogGroup) + com.google.protobuf.MessageOrBuilder { + + /** + * repeated .com.aliyun.gateway.sls.util.model.Log Logs = 1; + */ + java.util.List + getLogsList(); + /** + * repeated .com.aliyun.gateway.sls.util.model.Log Logs = 1; + */ + com.aliyun.gateway.sls.util.model.Logs.Log getLogs(int index); + /** + * repeated .com.aliyun.gateway.sls.util.model.Log Logs = 1; + */ + int getLogsCount(); + /** + * repeated .com.aliyun.gateway.sls.util.model.Log Logs = 1; + */ + java.util.List + getLogsOrBuilderList(); + /** + * repeated .com.aliyun.gateway.sls.util.model.Log Logs = 1; + */ + com.aliyun.gateway.sls.util.model.Logs.LogOrBuilder getLogsOrBuilder( + int index); + + /** + * optional string Topic = 3; + * @return Whether the topic field is set. + */ + boolean hasTopic(); + /** + * optional string Topic = 3; + * @return The topic. + */ + java.lang.String getTopic(); + /** + * optional string Topic = 3; + * @return The bytes for topic. + */ + com.google.protobuf.ByteString + getTopicBytes(); + + /** + * optional string Source = 4; + * @return Whether the source field is set. + */ + boolean hasSource(); + /** + * optional string Source = 4; + * @return The source. + */ + java.lang.String getSource(); + /** + * optional string Source = 4; + * @return The bytes for source. + */ + com.google.protobuf.ByteString + getSourceBytes(); + + /** + * repeated .com.aliyun.gateway.sls.util.model.LogTag LogTags = 6; + */ + java.util.List + getLogTagsList(); + /** + * repeated .com.aliyun.gateway.sls.util.model.LogTag LogTags = 6; + */ + com.aliyun.gateway.sls.util.model.Logs.LogTag getLogTags(int index); + /** + * repeated .com.aliyun.gateway.sls.util.model.LogTag LogTags = 6; + */ + int getLogTagsCount(); + /** + * repeated .com.aliyun.gateway.sls.util.model.LogTag LogTags = 6; + */ + java.util.List + getLogTagsOrBuilderList(); + /** + * repeated .com.aliyun.gateway.sls.util.model.LogTag LogTags = 6; + */ + com.aliyun.gateway.sls.util.model.Logs.LogTagOrBuilder getLogTagsOrBuilder( + int index); + } + /** + * Protobuf type {@code com.aliyun.gateway.sls.util.model.LogGroup} + */ + public static final class LogGroup extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.aliyun.gateway.sls.util.model.LogGroup) + LogGroupOrBuilder { + private static final long serialVersionUID = 0L; + // Use LogGroup.newBuilder() to construct. + private LogGroup(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private LogGroup() { + logs_ = java.util.Collections.emptyList(); + topic_ = ""; + source_ = ""; + logTags_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new LogGroup(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.aliyun.gateway.sls.util.model.Logs.internal_static_com_aliyun_gateway_sls_util_model_LogGroup_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.aliyun.gateway.sls.util.model.Logs.internal_static_com_aliyun_gateway_sls_util_model_LogGroup_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.aliyun.gateway.sls.util.model.Logs.LogGroup.class, com.aliyun.gateway.sls.util.model.Logs.LogGroup.Builder.class); + } + + private int bitField0_; + public static final int LOGS_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private java.util.List logs_; + /** + * repeated .com.aliyun.gateway.sls.util.model.Log Logs = 1; + */ + @java.lang.Override + public java.util.List getLogsList() { + return logs_; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.Log Logs = 1; + */ + @java.lang.Override + public java.util.List + getLogsOrBuilderList() { + return logs_; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.Log Logs = 1; + */ + @java.lang.Override + public int getLogsCount() { + return logs_.size(); + } + /** + * repeated .com.aliyun.gateway.sls.util.model.Log Logs = 1; + */ + @java.lang.Override + public com.aliyun.gateway.sls.util.model.Logs.Log getLogs(int index) { + return logs_.get(index); + } + /** + * repeated .com.aliyun.gateway.sls.util.model.Log Logs = 1; + */ + @java.lang.Override + public com.aliyun.gateway.sls.util.model.Logs.LogOrBuilder getLogsOrBuilder( + int index) { + return logs_.get(index); + } + + public static final int TOPIC_FIELD_NUMBER = 3; + @SuppressWarnings("serial") + private volatile java.lang.Object topic_ = ""; + /** + * optional string Topic = 3; + * @return Whether the topic field is set. + */ + @java.lang.Override + public boolean hasTopic() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * optional string Topic = 3; + * @return The topic. + */ + @java.lang.Override + public java.lang.String getTopic() { + java.lang.Object ref = topic_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + topic_ = s; + } + return s; + } + } + /** + * optional string Topic = 3; + * @return The bytes for topic. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getTopicBytes() { + java.lang.Object ref = topic_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + topic_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SOURCE_FIELD_NUMBER = 4; + @SuppressWarnings("serial") + private volatile java.lang.Object source_ = ""; + /** + * optional string Source = 4; + * @return Whether the source field is set. + */ + @java.lang.Override + public boolean hasSource() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * optional string Source = 4; + * @return The source. + */ + @java.lang.Override + public java.lang.String getSource() { + java.lang.Object ref = source_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + source_ = s; + } + return s; + } + } + /** + * optional string Source = 4; + * @return The bytes for source. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getSourceBytes() { + java.lang.Object ref = source_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + source_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int LOGTAGS_FIELD_NUMBER = 6; + @SuppressWarnings("serial") + private java.util.List logTags_; + /** + * repeated .com.aliyun.gateway.sls.util.model.LogTag LogTags = 6; + */ + @java.lang.Override + public java.util.List getLogTagsList() { + return logTags_; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogTag LogTags = 6; + */ + @java.lang.Override + public java.util.List + getLogTagsOrBuilderList() { + return logTags_; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogTag LogTags = 6; + */ + @java.lang.Override + public int getLogTagsCount() { + return logTags_.size(); + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogTag LogTags = 6; + */ + @java.lang.Override + public com.aliyun.gateway.sls.util.model.Logs.LogTag getLogTags(int index) { + return logTags_.get(index); + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogTag LogTags = 6; + */ + @java.lang.Override + public com.aliyun.gateway.sls.util.model.Logs.LogTagOrBuilder getLogTagsOrBuilder( + int index) { + return logTags_.get(index); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + for (int i = 0; i < getLogsCount(); i++) { + if (!getLogs(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + for (int i = 0; i < getLogTagsCount(); i++) { + if (!getLogTags(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + for (int i = 0; i < logs_.size(); i++) { + output.writeMessage(1, logs_.get(i)); + } + if (((bitField0_ & 0x00000001) != 0)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, topic_); + } + if (((bitField0_ & 0x00000002) != 0)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, source_); + } + for (int i = 0; i < logTags_.size(); i++) { + output.writeMessage(6, logTags_.get(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < logs_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, logs_.get(i)); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, topic_); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, source_); + } + for (int i = 0; i < logTags_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(6, logTags_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.aliyun.gateway.sls.util.model.Logs.LogGroup)) { + return super.equals(obj); + } + com.aliyun.gateway.sls.util.model.Logs.LogGroup other = (com.aliyun.gateway.sls.util.model.Logs.LogGroup) obj; + + if (!getLogsList() + .equals(other.getLogsList())) return false; + if (hasTopic() != other.hasTopic()) return false; + if (hasTopic()) { + if (!getTopic() + .equals(other.getTopic())) return false; + } + if (hasSource() != other.hasSource()) return false; + if (hasSource()) { + if (!getSource() + .equals(other.getSource())) return false; + } + if (!getLogTagsList() + .equals(other.getLogTagsList())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getLogsCount() > 0) { + hash = (37 * hash) + LOGS_FIELD_NUMBER; + hash = (53 * hash) + getLogsList().hashCode(); + } + if (hasTopic()) { + hash = (37 * hash) + TOPIC_FIELD_NUMBER; + hash = (53 * hash) + getTopic().hashCode(); + } + if (hasSource()) { + hash = (37 * hash) + SOURCE_FIELD_NUMBER; + hash = (53 * hash) + getSource().hashCode(); + } + if (getLogTagsCount() > 0) { + hash = (37 * hash) + LOGTAGS_FIELD_NUMBER; + hash = (53 * hash) + getLogTagsList().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.aliyun.gateway.sls.util.model.Logs.LogGroup parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.aliyun.gateway.sls.util.model.Logs.LogGroup parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.model.Logs.LogGroup parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.aliyun.gateway.sls.util.model.Logs.LogGroup parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.model.Logs.LogGroup parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.aliyun.gateway.sls.util.model.Logs.LogGroup parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.model.Logs.LogGroup parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.aliyun.gateway.sls.util.model.Logs.LogGroup parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static com.aliyun.gateway.sls.util.model.Logs.LogGroup parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + + public static com.aliyun.gateway.sls.util.model.Logs.LogGroup parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.model.Logs.LogGroup parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.aliyun.gateway.sls.util.model.Logs.LogGroup parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.aliyun.gateway.sls.util.model.Logs.LogGroup prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code com.aliyun.gateway.sls.util.model.LogGroup} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:com.aliyun.gateway.sls.util.model.LogGroup) + com.aliyun.gateway.sls.util.model.Logs.LogGroupOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.aliyun.gateway.sls.util.model.Logs.internal_static_com_aliyun_gateway_sls_util_model_LogGroup_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.aliyun.gateway.sls.util.model.Logs.internal_static_com_aliyun_gateway_sls_util_model_LogGroup_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.aliyun.gateway.sls.util.model.Logs.LogGroup.class, com.aliyun.gateway.sls.util.model.Logs.LogGroup.Builder.class); + } + + // Construct using com.aliyun.gateway.sls.util.model.Logs.LogGroup.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (logsBuilder_ == null) { + logs_ = java.util.Collections.emptyList(); + } else { + logs_ = null; + logsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + topic_ = ""; + source_ = ""; + if (logTagsBuilder_ == null) { + logTags_ = java.util.Collections.emptyList(); + } else { + logTags_ = null; + logTagsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.aliyun.gateway.sls.util.model.Logs.internal_static_com_aliyun_gateway_sls_util_model_LogGroup_descriptor; + } + + @java.lang.Override + public com.aliyun.gateway.sls.util.model.Logs.LogGroup getDefaultInstanceForType() { + return com.aliyun.gateway.sls.util.model.Logs.LogGroup.getDefaultInstance(); + } + + @java.lang.Override + public com.aliyun.gateway.sls.util.model.Logs.LogGroup build() { + com.aliyun.gateway.sls.util.model.Logs.LogGroup result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.aliyun.gateway.sls.util.model.Logs.LogGroup buildPartial() { + com.aliyun.gateway.sls.util.model.Logs.LogGroup result = new com.aliyun.gateway.sls.util.model.Logs.LogGroup(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(com.aliyun.gateway.sls.util.model.Logs.LogGroup result) { + if (logsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + logs_ = java.util.Collections.unmodifiableList(logs_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.logs_ = logs_; + } else { + result.logs_ = logsBuilder_.build(); + } + if (logTagsBuilder_ == null) { + if (((bitField0_ & 0x00000008) != 0)) { + logTags_ = java.util.Collections.unmodifiableList(logTags_); + bitField0_ = (bitField0_ & ~0x00000008); + } + result.logTags_ = logTags_; + } else { + result.logTags_ = logTagsBuilder_.build(); + } + } + + private void buildPartial0(com.aliyun.gateway.sls.util.model.Logs.LogGroup result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.topic_ = topic_; + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.source_ = source_; + to_bitField0_ |= 0x00000002; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.aliyun.gateway.sls.util.model.Logs.LogGroup) { + return mergeFrom((com.aliyun.gateway.sls.util.model.Logs.LogGroup)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.aliyun.gateway.sls.util.model.Logs.LogGroup other) { + if (other == com.aliyun.gateway.sls.util.model.Logs.LogGroup.getDefaultInstance()) return this; + if (logsBuilder_ == null) { + if (!other.logs_.isEmpty()) { + if (logs_.isEmpty()) { + logs_ = other.logs_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureLogsIsMutable(); + logs_.addAll(other.logs_); + } + onChanged(); + } + } else { + if (!other.logs_.isEmpty()) { + if (logsBuilder_.isEmpty()) { + logsBuilder_.dispose(); + logsBuilder_ = null; + logs_ = other.logs_; + bitField0_ = (bitField0_ & ~0x00000001); + logsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + getLogsFieldBuilder() : null; + } else { + logsBuilder_.addAllMessages(other.logs_); + } + } + } + if (other.hasTopic()) { + topic_ = other.topic_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (other.hasSource()) { + source_ = other.source_; + bitField0_ |= 0x00000004; + onChanged(); + } + if (logTagsBuilder_ == null) { + if (!other.logTags_.isEmpty()) { + if (logTags_.isEmpty()) { + logTags_ = other.logTags_; + bitField0_ = (bitField0_ & ~0x00000008); + } else { + ensureLogTagsIsMutable(); + logTags_.addAll(other.logTags_); + } + onChanged(); + } + } else { + if (!other.logTags_.isEmpty()) { + if (logTagsBuilder_.isEmpty()) { + logTagsBuilder_.dispose(); + logTagsBuilder_ = null; + logTags_ = other.logTags_; + bitField0_ = (bitField0_ & ~0x00000008); + logTagsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + getLogTagsFieldBuilder() : null; + } else { + logTagsBuilder_.addAllMessages(other.logTags_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + for (int i = 0; i < getLogsCount(); i++) { + if (!getLogs(i).isInitialized()) { + return false; + } + } + for (int i = 0; i < getLogTagsCount(); i++) { + if (!getLogTags(i).isInitialized()) { + return false; + } + } + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + com.aliyun.gateway.sls.util.model.Logs.Log m = + input.readMessage( + com.aliyun.gateway.sls.util.model.Logs.Log.PARSER, + extensionRegistry); + if (logsBuilder_ == null) { + ensureLogsIsMutable(); + logs_.add(m); + } else { + logsBuilder_.addMessage(m); + } + break; + } // case 10 + case 26: { + topic_ = input.readBytes(); + bitField0_ |= 0x00000002; + break; + } // case 26 + case 34: { + source_ = input.readBytes(); + bitField0_ |= 0x00000004; + break; + } // case 34 + case 50: { + com.aliyun.gateway.sls.util.model.Logs.LogTag m = + input.readMessage( + com.aliyun.gateway.sls.util.model.Logs.LogTag.PARSER, + extensionRegistry); + if (logTagsBuilder_ == null) { + ensureLogTagsIsMutable(); + logTags_.add(m); + } else { + logTagsBuilder_.addMessage(m); + } + break; + } // case 50 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.util.List logs_ = + java.util.Collections.emptyList(); + private void ensureLogsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + logs_ = new java.util.ArrayList(logs_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.aliyun.gateway.sls.util.model.Logs.Log, com.aliyun.gateway.sls.util.model.Logs.Log.Builder, com.aliyun.gateway.sls.util.model.Logs.LogOrBuilder> logsBuilder_; + + /** + * repeated .com.aliyun.gateway.sls.util.model.Log Logs = 1; + */ + public java.util.List getLogsList() { + if (logsBuilder_ == null) { + return java.util.Collections.unmodifiableList(logs_); + } else { + return logsBuilder_.getMessageList(); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.model.Log Logs = 1; + */ + public int getLogsCount() { + if (logsBuilder_ == null) { + return logs_.size(); + } else { + return logsBuilder_.getCount(); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.model.Log Logs = 1; + */ + public com.aliyun.gateway.sls.util.model.Logs.Log getLogs(int index) { + if (logsBuilder_ == null) { + return logs_.get(index); + } else { + return logsBuilder_.getMessage(index); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.model.Log Logs = 1; + */ + public Builder setLogs( + int index, com.aliyun.gateway.sls.util.model.Logs.Log value) { + if (logsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLogsIsMutable(); + logs_.set(index, value); + onChanged(); + } else { + logsBuilder_.setMessage(index, value); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.Log Logs = 1; + */ + public Builder setLogs( + int index, com.aliyun.gateway.sls.util.model.Logs.Log.Builder builderForValue) { + if (logsBuilder_ == null) { + ensureLogsIsMutable(); + logs_.set(index, builderForValue.build()); + onChanged(); + } else { + logsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.Log Logs = 1; + */ + public Builder addLogs(com.aliyun.gateway.sls.util.model.Logs.Log value) { + if (logsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLogsIsMutable(); + logs_.add(value); + onChanged(); + } else { + logsBuilder_.addMessage(value); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.Log Logs = 1; + */ + public Builder addLogs( + int index, com.aliyun.gateway.sls.util.model.Logs.Log value) { + if (logsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLogsIsMutable(); + logs_.add(index, value); + onChanged(); + } else { + logsBuilder_.addMessage(index, value); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.Log Logs = 1; + */ + public Builder addLogs( + com.aliyun.gateway.sls.util.model.Logs.Log.Builder builderForValue) { + if (logsBuilder_ == null) { + ensureLogsIsMutable(); + logs_.add(builderForValue.build()); + onChanged(); + } else { + logsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.Log Logs = 1; + */ + public Builder addLogs( + int index, com.aliyun.gateway.sls.util.model.Logs.Log.Builder builderForValue) { + if (logsBuilder_ == null) { + ensureLogsIsMutable(); + logs_.add(index, builderForValue.build()); + onChanged(); + } else { + logsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.Log Logs = 1; + */ + public Builder addAllLogs( + java.lang.Iterable values) { + if (logsBuilder_ == null) { + ensureLogsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, logs_); + onChanged(); + } else { + logsBuilder_.addAllMessages(values); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.Log Logs = 1; + */ + public Builder clearLogs() { + if (logsBuilder_ == null) { + logs_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + logsBuilder_.clear(); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.Log Logs = 1; + */ + public Builder removeLogs(int index) { + if (logsBuilder_ == null) { + ensureLogsIsMutable(); + logs_.remove(index); + onChanged(); + } else { + logsBuilder_.remove(index); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.Log Logs = 1; + */ + public com.aliyun.gateway.sls.util.model.Logs.Log.Builder getLogsBuilder( + int index) { + return getLogsFieldBuilder().getBuilder(index); + } + /** + * repeated .com.aliyun.gateway.sls.util.model.Log Logs = 1; + */ + public com.aliyun.gateway.sls.util.model.Logs.LogOrBuilder getLogsOrBuilder( + int index) { + if (logsBuilder_ == null) { + return logs_.get(index); } else { + return logsBuilder_.getMessageOrBuilder(index); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.model.Log Logs = 1; + */ + public java.util.List + getLogsOrBuilderList() { + if (logsBuilder_ != null) { + return logsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(logs_); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.model.Log Logs = 1; + */ + public com.aliyun.gateway.sls.util.model.Logs.Log.Builder addLogsBuilder() { + return getLogsFieldBuilder().addBuilder( + com.aliyun.gateway.sls.util.model.Logs.Log.getDefaultInstance()); + } + /** + * repeated .com.aliyun.gateway.sls.util.model.Log Logs = 1; + */ + public com.aliyun.gateway.sls.util.model.Logs.Log.Builder addLogsBuilder( + int index) { + return getLogsFieldBuilder().addBuilder( + index, com.aliyun.gateway.sls.util.model.Logs.Log.getDefaultInstance()); + } + /** + * repeated .com.aliyun.gateway.sls.util.model.Log Logs = 1; + */ + public java.util.List + getLogsBuilderList() { + return getLogsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilderV3< + com.aliyun.gateway.sls.util.model.Logs.Log, com.aliyun.gateway.sls.util.model.Logs.Log.Builder, com.aliyun.gateway.sls.util.model.Logs.LogOrBuilder> + getLogsFieldBuilder() { + if (logsBuilder_ == null) { + logsBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + com.aliyun.gateway.sls.util.model.Logs.Log, com.aliyun.gateway.sls.util.model.Logs.Log.Builder, com.aliyun.gateway.sls.util.model.Logs.LogOrBuilder>( + logs_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + logs_ = null; + } + return logsBuilder_; + } + + private java.lang.Object topic_ = ""; + /** + * optional string Topic = 3; + * @return Whether the topic field is set. + */ + public boolean hasTopic() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * optional string Topic = 3; + * @return The topic. + */ + public java.lang.String getTopic() { + java.lang.Object ref = topic_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + topic_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * optional string Topic = 3; + * @return The bytes for topic. + */ + public com.google.protobuf.ByteString + getTopicBytes() { + java.lang.Object ref = topic_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + topic_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string Topic = 3; + * @param value The topic to set. + * @return This builder for chaining. + */ + public Builder setTopic( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + topic_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * optional string Topic = 3; + * @return This builder for chaining. + */ + public Builder clearTopic() { + topic_ = getDefaultInstance().getTopic(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * optional string Topic = 3; + * @param value The bytes for topic to set. + * @return This builder for chaining. + */ + public Builder setTopicBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + topic_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private java.lang.Object source_ = ""; + /** + * optional string Source = 4; + * @return Whether the source field is set. + */ + public boolean hasSource() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * optional string Source = 4; + * @return The source. + */ + public java.lang.String getSource() { + java.lang.Object ref = source_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + source_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * optional string Source = 4; + * @return The bytes for source. + */ + public com.google.protobuf.ByteString + getSourceBytes() { + java.lang.Object ref = source_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + source_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string Source = 4; + * @param value The source to set. + * @return This builder for chaining. + */ + public Builder setSource( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + source_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * optional string Source = 4; + * @return This builder for chaining. + */ + public Builder clearSource() { + source_ = getDefaultInstance().getSource(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + * optional string Source = 4; + * @param value The bytes for source to set. + * @return This builder for chaining. + */ + public Builder setSourceBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + source_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + private java.util.List logTags_ = + java.util.Collections.emptyList(); + private void ensureLogTagsIsMutable() { + if (!((bitField0_ & 0x00000008) != 0)) { + logTags_ = new java.util.ArrayList(logTags_); + bitField0_ |= 0x00000008; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.aliyun.gateway.sls.util.model.Logs.LogTag, com.aliyun.gateway.sls.util.model.Logs.LogTag.Builder, com.aliyun.gateway.sls.util.model.Logs.LogTagOrBuilder> logTagsBuilder_; + + /** + * repeated .com.aliyun.gateway.sls.util.model.LogTag LogTags = 6; + */ + public java.util.List getLogTagsList() { + if (logTagsBuilder_ == null) { + return java.util.Collections.unmodifiableList(logTags_); + } else { + return logTagsBuilder_.getMessageList(); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogTag LogTags = 6; + */ + public int getLogTagsCount() { + if (logTagsBuilder_ == null) { + return logTags_.size(); + } else { + return logTagsBuilder_.getCount(); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogTag LogTags = 6; + */ + public com.aliyun.gateway.sls.util.model.Logs.LogTag getLogTags(int index) { + if (logTagsBuilder_ == null) { + return logTags_.get(index); + } else { + return logTagsBuilder_.getMessage(index); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogTag LogTags = 6; + */ + public Builder setLogTags( + int index, com.aliyun.gateway.sls.util.model.Logs.LogTag value) { + if (logTagsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLogTagsIsMutable(); + logTags_.set(index, value); + onChanged(); + } else { + logTagsBuilder_.setMessage(index, value); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogTag LogTags = 6; + */ + public Builder setLogTags( + int index, com.aliyun.gateway.sls.util.model.Logs.LogTag.Builder builderForValue) { + if (logTagsBuilder_ == null) { + ensureLogTagsIsMutable(); + logTags_.set(index, builderForValue.build()); + onChanged(); + } else { + logTagsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogTag LogTags = 6; + */ + public Builder addLogTags(com.aliyun.gateway.sls.util.model.Logs.LogTag value) { + if (logTagsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLogTagsIsMutable(); + logTags_.add(value); + onChanged(); + } else { + logTagsBuilder_.addMessage(value); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogTag LogTags = 6; + */ + public Builder addLogTags( + int index, com.aliyun.gateway.sls.util.model.Logs.LogTag value) { + if (logTagsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLogTagsIsMutable(); + logTags_.add(index, value); + onChanged(); + } else { + logTagsBuilder_.addMessage(index, value); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogTag LogTags = 6; + */ + public Builder addLogTags( + com.aliyun.gateway.sls.util.model.Logs.LogTag.Builder builderForValue) { + if (logTagsBuilder_ == null) { + ensureLogTagsIsMutable(); + logTags_.add(builderForValue.build()); + onChanged(); + } else { + logTagsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogTag LogTags = 6; + */ + public Builder addLogTags( + int index, com.aliyun.gateway.sls.util.model.Logs.LogTag.Builder builderForValue) { + if (logTagsBuilder_ == null) { + ensureLogTagsIsMutable(); + logTags_.add(index, builderForValue.build()); + onChanged(); + } else { + logTagsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogTag LogTags = 6; + */ + public Builder addAllLogTags( + java.lang.Iterable values) { + if (logTagsBuilder_ == null) { + ensureLogTagsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, logTags_); + onChanged(); + } else { + logTagsBuilder_.addAllMessages(values); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogTag LogTags = 6; + */ + public Builder clearLogTags() { + if (logTagsBuilder_ == null) { + logTags_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + } else { + logTagsBuilder_.clear(); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogTag LogTags = 6; + */ + public Builder removeLogTags(int index) { + if (logTagsBuilder_ == null) { + ensureLogTagsIsMutable(); + logTags_.remove(index); + onChanged(); + } else { + logTagsBuilder_.remove(index); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogTag LogTags = 6; + */ + public com.aliyun.gateway.sls.util.model.Logs.LogTag.Builder getLogTagsBuilder( + int index) { + return getLogTagsFieldBuilder().getBuilder(index); + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogTag LogTags = 6; + */ + public com.aliyun.gateway.sls.util.model.Logs.LogTagOrBuilder getLogTagsOrBuilder( + int index) { + if (logTagsBuilder_ == null) { + return logTags_.get(index); } else { + return logTagsBuilder_.getMessageOrBuilder(index); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogTag LogTags = 6; + */ + public java.util.List + getLogTagsOrBuilderList() { + if (logTagsBuilder_ != null) { + return logTagsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(logTags_); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogTag LogTags = 6; + */ + public com.aliyun.gateway.sls.util.model.Logs.LogTag.Builder addLogTagsBuilder() { + return getLogTagsFieldBuilder().addBuilder( + com.aliyun.gateway.sls.util.model.Logs.LogTag.getDefaultInstance()); + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogTag LogTags = 6; + */ + public com.aliyun.gateway.sls.util.model.Logs.LogTag.Builder addLogTagsBuilder( + int index) { + return getLogTagsFieldBuilder().addBuilder( + index, com.aliyun.gateway.sls.util.model.Logs.LogTag.getDefaultInstance()); + } + /** + * repeated .com.aliyun.gateway.sls.util.model.LogTag LogTags = 6; + */ + public java.util.List + getLogTagsBuilderList() { + return getLogTagsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilderV3< + com.aliyun.gateway.sls.util.model.Logs.LogTag, com.aliyun.gateway.sls.util.model.Logs.LogTag.Builder, com.aliyun.gateway.sls.util.model.Logs.LogTagOrBuilder> + getLogTagsFieldBuilder() { + if (logTagsBuilder_ == null) { + logTagsBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + com.aliyun.gateway.sls.util.model.Logs.LogTag, com.aliyun.gateway.sls.util.model.Logs.LogTag.Builder, com.aliyun.gateway.sls.util.model.Logs.LogTagOrBuilder>( + logTags_, + ((bitField0_ & 0x00000008) != 0), + getParentForChildren(), + isClean()); + logTags_ = null; + } + return logTagsBuilder_; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.aliyun.gateway.sls.util.model.LogGroup) + } + + // @@protoc_insertion_point(class_scope:com.aliyun.gateway.sls.util.model.LogGroup) + private static final com.aliyun.gateway.sls.util.model.Logs.LogGroup DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.aliyun.gateway.sls.util.model.Logs.LogGroup(); + } + + public static com.aliyun.gateway.sls.util.model.Logs.LogGroup getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + @java.lang.Deprecated public static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public LogGroup parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.aliyun.gateway.sls.util.model.Logs.LogGroup getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_aliyun_gateway_sls_util_model_LogContent_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_aliyun_gateway_sls_util_model_LogContent_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_aliyun_gateway_sls_util_model_Log_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_aliyun_gateway_sls_util_model_Log_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_aliyun_gateway_sls_util_model_LogTag_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_aliyun_gateway_sls_util_model_LogTag_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_aliyun_gateway_sls_util_model_LogGroup_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_aliyun_gateway_sls_util_model_LogGroup_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n\nlogs.proto\022!com.aliyun.gateway.sls.uti" + + "l.model\"(\n\nLogContent\022\013\n\003Key\030\001 \002(\t\022\r\n\005Va" + + "lue\030\002 \002(\t\"d\n\003Log\022\014\n\004Time\030\001 \002(\r\022?\n\010Conten" + + "ts\030\002 \003(\0132-.com.aliyun.gateway.sls.util.m" + + "odel.LogContent\022\016\n\006TimeNs\030\004 \001(\007\"$\n\006LogTa" + + "g\022\013\n\003Key\030\001 \002(\t\022\r\n\005Value\030\002 \002(\t\"\233\001\n\010LogGro" + + "up\0224\n\004Logs\030\001 \003(\0132&.com.aliyun.gateway.sl" + + "s.util.model.Log\022\r\n\005Topic\030\003 \001(\t\022\016\n\006Sourc" + + "e\030\004 \001(\t\022:\n\007LogTags\030\006 \003(\0132).com.aliyun.ga" + + "teway.sls.util.model.LogTag" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }); + internal_static_com_aliyun_gateway_sls_util_model_LogContent_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_com_aliyun_gateway_sls_util_model_LogContent_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_aliyun_gateway_sls_util_model_LogContent_descriptor, + new java.lang.String[] { "Key", "Value", }); + internal_static_com_aliyun_gateway_sls_util_model_Log_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_com_aliyun_gateway_sls_util_model_Log_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_aliyun_gateway_sls_util_model_Log_descriptor, + new java.lang.String[] { "Time", "Contents", "TimeNs", }); + internal_static_com_aliyun_gateway_sls_util_model_LogTag_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_com_aliyun_gateway_sls_util_model_LogTag_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_aliyun_gateway_sls_util_model_LogTag_descriptor, + new java.lang.String[] { "Key", "Value", }); + internal_static_com_aliyun_gateway_sls_util_model_LogGroup_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_com_aliyun_gateway_sls_util_model_LogGroup_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_aliyun_gateway_sls_util_model_LogGroup_descriptor, + new java.lang.String[] { "Logs", "Topic", "Source", "LogTags", }); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PostLogStoreLogsRequest.java b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PostLogStoreLogsRequest.java new file mode 100644 index 00000000..e02ee6cb --- /dev/null +++ b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PostLogStoreLogsRequest.java @@ -0,0 +1,146 @@ +package com.aliyun.gateway.sls.util.model; + +import com.aliyun.tea.utils.StringUtils; + +import java.io.Serializable; +import java.util.List; +import java.util.UUID; + +public class PostLogStoreLogsRequest implements Serializable { + private static final long serialVersionUID = 7226856831224917838L; + private String topic; + private String source; + private String hashKey; + private List logItems; + private List tags = null; + private String compressType = "lz4"; + private Integer hashRouteKeySeqId; + + public byte[] serializeToPbBytes() { + Logs.LogGroup.Builder logs = Logs.LogGroup.newBuilder(); + if (!StringUtils.isEmpty(topic)) { + logs.setTopic(topic); + } + if (!StringUtils.isEmpty(source)) { + logs.setSource(source); + } + + if (tags != null && !tags.isEmpty()) { + for (LogTag tag : tags) { + Logs.LogTag.Builder tagBuilder = logs.addLogTagsBuilder(); + tagBuilder.setKey(tag.getKey()); + tagBuilder.setValue(tag.getValue()); + } + } + for (LogItem item : logItems) { + Logs.Log.Builder log = logs.addLogsBuilder(); + log.setTime(item.getTime()); + if (item.hasTimeNsPart()) { + log.setTimeNs(item.getTimeNsPart()); + } + + for (LogContent content : item.getLogContents()) { + Logs.LogContent.Builder contentBuilder = log.addContentsBuilder(); + contentBuilder.setKey(content.getKey()); + if (content.getValue() == null) { + contentBuilder.setValue(""); + } else { + contentBuilder.setValue(content.getValue()); + } + } + } + return logs.build().toByteArray(); + } + + public String getCompressType() { + return compressType; + } + + public void setCompressType(String compressType) { + this.compressType = compressType; + } + + /** + * Get the topic + * + * @return the topic + */ + public String getTopic() { + return topic; + } + + /** + * Set topic value + * + * @param topic topic value + */ + public void setTopic(String topic) { + this.topic = topic; + } + + /** + * Get log source + * + * @return log source + */ + public String getSource() { + return source; + } + + /** + * Set log source + * + * @param source log source + */ + public void setSource(String source) { + this.source = source; + } + + /** + * Get all the log data + * + * @return log data + */ + public List getLogItems() { + return logItems; + } + + /** + * Get all the tag + * + * @return tag + */ + public List getTags() { + return tags; + } + + /** + * Set the log data , shallow copy is used to set the log data + * + * @param logItems log data + */ + public void setLogItems(List logItems) { + this.logItems = logItems; + } + + public void setTags(List tags) { + this.tags = tags; + } + + public String getHashKey() { + return hashKey; + } + + public void setHashKey(String mHashKey) { + this.hashKey = mHashKey; + } + + public Integer getHashRouteKeySeqId() { + return hashRouteKeySeqId; + } + + public void setHashRouteKeySeqId(Integer hashRouteKeySeqId) { + this.hashRouteKeySeqId = hashRouteKeySeqId; + } + +} diff --git a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PullLogsResponseBody.java b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PullLogsResponseBody.java new file mode 100644 index 00000000..c1aa385a --- /dev/null +++ b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PullLogsResponseBody.java @@ -0,0 +1,113 @@ +package com.aliyun.gateway.sls.util.model; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class PullLogsResponseBody implements Serializable { + private static final long serialVersionUID = -2027711570684362279L; + // init fields + private final byte[] rawData; + private final Map headers; + private final int statusCode; + // parsed fields + private List logGroups; + private int count; + private String requestId; + private long cursorTime; + private boolean isEndOfCursor; + + public PullLogsResponseBody(byte[] rawData, int statusCode, Map headers) { + this.rawData = rawData; + this.statusCode = statusCode; + this.headers = headers; + parseHeaders(); + } + + public List getLogGroups() throws LogException { + if (logGroups == null) { + parseFastLogGroupList(rawData); + } + return logGroups; + } + + /** + * Get number of logGroups + * + * @return number of logGroups fetched + */ + public int getCount() { + return count; + } + + public long getCursorTime() { + return cursorTime; + } + + public boolean isEndOfCursor() { + return isEndOfCursor; + } + + private void parseHeaders() { + requestId = headers.get("x-request-id"); + isEndOfCursor = "1".equals(headers.get("x-log-end-of-cursor")); + try { + count = Integer.parseInt(headers.get("x-log-count")); + String cursorTimeHeader = headers.get("x-log-cursor-time"); + cursorTime = cursorTimeHeader != null && !cursorTimeHeader.isEmpty() ? Long.parseLong(cursorTimeHeader.trim()) : 0; + } catch (NumberFormatException e) { + throw new LogException("ParsePullLogHeaderError", e.getMessage(), requestId); + } + } + + /** + * Parse LogGroupList using fast deserialize method. + * + * @param data is LogGroupList bytes + * @throws LogException if parse fails + */ + private void parseFastLogGroupList(byte[] data) throws LogException { + logGroups = new ArrayList<>(); + if (data == null || data.length == 0) { + return; + } + int pos = 0; + int rawSize = data.length; + int mode, index; + while (pos < rawSize) { + int[] value = VarintUtil.DecodeVarInt32(data, pos, rawSize); + if (value[0] == 0) { + throw new LogException("InitLogGroupsError", "decode varint32 error", requestId, statusCode); + } + pos = value[2]; + mode = value[1] & 0x7; + index = value[1] >> 3; + if (mode == 0) { + value = VarintUtil.DecodeVarInt32(data, pos, rawSize); + if (value[0] == 0) { + throw new LogException("InitLogGroupsError", "decode varint32 error", requestId, statusCode); + } + pos = value[2]; + } else if (mode == 1) { + pos += 8; + } else if (mode == 2) { + value = VarintUtil.DecodeVarInt32(data, pos, rawSize); + if (value[0] == 0) { + throw new LogException("InitLogGroupsError", "decode varint32 error", requestId, statusCode); + } + if (index == 1) { + logGroups.add(new FastLogGroup(data, value[2], value[1], requestId)); + } + pos = value[1] + value[2]; + } else if (mode == 5) { + pos += 4; + } else { + throw new LogException("InitLogGroupsError", "mode: " + mode, requestId, statusCode); + } + } + if (pos != rawSize) { + throw new LogException("InitLogGroupsError", "parse LogGroupList fail", requestId, statusCode); + } + } +} diff --git a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/VarintUtil.java b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/VarintUtil.java new file mode 100644 index 00000000..b78e36e9 --- /dev/null +++ b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/VarintUtil.java @@ -0,0 +1,20 @@ +package com.aliyun.gateway.sls.util.model; + +public class VarintUtil { + public static int[] DecodeVarInt32(byte[] dataBytes, int pos, int maxPos) { + int value[] = {0, 0, 0}; + int shift = 0; + int b; + for (int i = pos; i < maxPos; ++i) { + b = dataBytes[i] & 0xff; + value[1] |= (b & 127) << shift; + shift += 7; + if ((b & 128) == 0) { + value[2] = i + 1; + value[0] = 1; + break; + } + } + return value; + } +} diff --git a/alibabacloud-gateway-sls/util/log.proto b/alibabacloud-gateway-sls/util/log.proto new file mode 100644 index 00000000..a4d2b729 --- /dev/null +++ b/alibabacloud-gateway-sls/util/log.proto @@ -0,0 +1,28 @@ +syntax = "proto2"; + +message LogContent +{ + required string Key = 1; + required string Value = 2; +} + +message Log +{ + required uint32 Time = 1; + repeated LogContent Contents= 2; + optional fixed32 TimeNs = 4; +} + +message LogTag +{ + required string Key = 1; + required string Value = 2; +} + +message LogGroup +{ + repeated Log Logs= 1; + optional string Topic = 3; + optional string Source = 4; + repeated LogTag LogTags = 6; +} \ No newline at end of file diff --git a/alibabacloud-gateway-sls/util/main.tea b/alibabacloud-gateway-sls/util/main.tea index b86762c8..7ac2b9cd 100644 --- a/alibabacloud-gateway-sls/util/main.tea +++ b/alibabacloud-gateway-sls/util/main.tea @@ -1,34 +1,12 @@ +typedef PostLogStoreLogsRequest; +typedef PullLogResponse; + /** * Read data from a readable stream, and parse it by JSON format * @param stream the readable stream * @return the parsed result */ -static async function readAndUncompressBlock(stream: readable, compressType: string, bodyRawSize: string): readable - -model LogContent { - key: string(name='key', description='Key of log content'), - value: string(name='value', description='Value of log content') -} - -model LogTag { - key: string(name='key', description='Key of log tag'), - value: string(name='key', description='Value of log tag') -} - -model Log { - time: uint32(name='time', description='Log time, unix timestamp in seconds', example='1724057168'), - contents: [LogContent](name='contents', description='Contents of the log, contains of key/value pair'), - timeNs ?: uint32(name='timeNs', description='Nano part of the log time, between [0, 999999999]', example='123456789') -} - -model LogGroup { - topic ?: string(name='topic', description='Topic of logGroup', example='my-topic'), - source ?: string(name='time', description='Source of logGroup', example='127.0.0.1'), - logs: [Log](name='logs', description='Logs of logGroup'), - logTags ?: [LogTag](name='logTags', description='Tags of logGroup') -} - -model LogGroupList { - logGroupList: [LogGroup] -} +static async function readAndUncompressBlock(stream: readable, compressType: string, bodyRawSize: string): readable; +static async function SerializeToPbBytes(request: PostLogStoreLogsRequest) : bytes; +static async function DeserializeFromPbBytes(resp: PullLogResponse, data: bytes) : void; \ No newline at end of file From 4d0fc1973d3f35831eb9346d599dad0578524b69 Mon Sep 17 00:00:00 2001 From: "shuizhao.gh" Date: Tue, 27 Aug 2024 16:04:48 +0800 Subject: [PATCH 3/4] feat: add more model --- .../com/aliyun/gateway/sls/util/Client.java | 6 +- .../util/model/PostLogStoreLogsRequest.java | 32 ++-- .../util/model/PostLogStoreLogsResponse.java | 145 ++++++++++++++++++ .../sls/util/model/PullLogsRequest.java | 55 +++++++ .../sls/util/model/PullLogsResponse.java | 42 +++++ .../sls/util/model/PullLogsResponseBody.java | 113 -------------- 6 files changed, 257 insertions(+), 136 deletions(-) create mode 100644 alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PostLogStoreLogsResponse.java create mode 100644 alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PullLogsRequest.java create mode 100644 alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PullLogsResponse.java delete mode 100644 alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PullLogsResponseBody.java diff --git a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/Client.java b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/Client.java index d7f3d7bd..1140d579 100644 --- a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/Client.java +++ b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/Client.java @@ -6,7 +6,7 @@ import java.util.Map; import com.aliyun.gateway.sls.util.model.PostLogStoreLogsRequest; -import com.aliyun.gateway.sls.util.model.PullLogsResponseBody; +import com.aliyun.gateway.sls.util.model.PostLogStoreLogsResponse; public class Client { @@ -21,7 +21,7 @@ public static byte[] SerializeToPbBytes(PostLogStoreLogsRequest request) throws return request.serializeToPbBytes(); } - public static PullLogsResponseBody DeserializeFromPbBytes(byte[] uncompressedData, int statusCode, Map headers) throws Exception { - return new PullLogsResponseBody(uncompressedData, statusCode, headers); + public static PostLogStoreLogsResponse.PullLogsResponseBody DeserializeFromPbBytes(byte[] uncompressedData, int statusCode, Map headers) throws Exception { + return new PostLogStoreLogsResponse.PullLogsResponseBody(uncompressedData, statusCode, headers); } } \ No newline at end of file diff --git a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PostLogStoreLogsRequest.java b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PostLogStoreLogsRequest.java index e02ee6cb..9c24e775 100644 --- a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PostLogStoreLogsRequest.java +++ b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PostLogStoreLogsRequest.java @@ -4,17 +4,26 @@ import java.io.Serializable; import java.util.List; -import java.util.UUID; public class PostLogStoreLogsRequest implements Serializable { private static final long serialVersionUID = 7226856831224917838L; private String topic; private String source; - private String hashKey; private List logItems; private List tags = null; private String compressType = "lz4"; - private Integer hashRouteKeySeqId; + + // POST /logstores/{logStore}/shards/lb + // content-type: application/x-protobuf + // extra header: + // x-log-compresstype: {compressType} + // x-log-bodyrawsize: {rawSize} + public PostLogStoreLogsRequest(String topic, String source, List logItems, List tags) { + this.topic = topic; + this.source = source; + this.logItems = logItems; + this.tags = tags; + } public byte[] serializeToPbBytes() { Logs.LogGroup.Builder logs = Logs.LogGroup.newBuilder(); @@ -126,21 +135,4 @@ public void setLogItems(List logItems) { public void setTags(List tags) { this.tags = tags; } - - public String getHashKey() { - return hashKey; - } - - public void setHashKey(String mHashKey) { - this.hashKey = mHashKey; - } - - public Integer getHashRouteKeySeqId() { - return hashRouteKeySeqId; - } - - public void setHashRouteKeySeqId(Integer hashRouteKeySeqId) { - this.hashRouteKeySeqId = hashRouteKeySeqId; - } - } diff --git a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PostLogStoreLogsResponse.java b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PostLogStoreLogsResponse.java new file mode 100644 index 00000000..e0aaf7a4 --- /dev/null +++ b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PostLogStoreLogsResponse.java @@ -0,0 +1,145 @@ +package com.aliyun.gateway.sls.util.model; + +import com.aliyun.tea.NameInMap; +import com.aliyun.tea.TeaModel; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class PostLogStoreLogsResponse extends TeaModel { + @NameInMap("headers") + public java.util.Map headers; + + @NameInMap("statusCode") + public Integer statusCode; + + public static PostLogStoreLogsResponse build(java.util.Map map) throws Exception { + PostLogStoreLogsResponse self = new PostLogStoreLogsResponse(); + return TeaModel.build(map, self); + } + + public PostLogStoreLogsResponse setHeaders(java.util.Map headers) { + this.headers = headers; + return this; + } + public java.util.Map getHeaders() { + return this.headers; + } + + public PostLogStoreLogsResponse setStatusCode(Integer statusCode) { + this.statusCode = statusCode; + return this; + } + public Integer getStatusCode() { + return this.statusCode; + } + + public static class PullLogsResponseBody implements Serializable { + private static final long serialVersionUID = -2027711570684362279L; + // init fields + private final byte[] rawData; + private final Map headers; + private final int statusCode; + // parsed fields + private List logGroups; + private int count; + private String requestId; + private long cursorTime; + private boolean isEndOfCursor; + + public PullLogsResponseBody(byte[] rawData, int statusCode, Map headers) { + this.rawData = rawData; + this.statusCode = statusCode; + this.headers = headers; + parseHeaders(); + } + + public List getLogGroups() throws LogException { + if (logGroups == null) { + parseFastLogGroupList(rawData); + } + return logGroups; + } + + /** + * Get number of logGroups + * + * @return number of logGroups fetched + */ + public int getCount() { + return count; + } + + public long getCursorTime() { + return cursorTime; + } + + public boolean isEndOfCursor() { + return isEndOfCursor; + } + + private void parseHeaders() { + requestId = headers.get("x-request-id"); + isEndOfCursor = "1".equals(headers.get("x-log-end-of-cursor")); + try { + count = Integer.parseInt(headers.get("x-log-count")); + String cursorTimeHeader = headers.get("x-log-cursor-time"); + cursorTime = cursorTimeHeader != null && !cursorTimeHeader.isEmpty() ? Long.parseLong(cursorTimeHeader.trim()) : 0; + } catch (NumberFormatException e) { + throw new LogException("ParsePullLogHeaderError", e.getMessage(), requestId); + } + } + + /** + * Parse LogGroupList using fast deserialize method. + * + * @param data is LogGroupList bytes + * @throws LogException if parse fails + */ + private void parseFastLogGroupList(byte[] data) throws LogException { + logGroups = new ArrayList<>(); + if (data == null || data.length == 0) { + return; + } + int pos = 0; + int rawSize = data.length; + int mode, index; + while (pos < rawSize) { + int[] value = VarintUtil.DecodeVarInt32(data, pos, rawSize); + if (value[0] == 0) { + throw new LogException("InitLogGroupsError", "decode varint32 error", requestId, statusCode); + } + pos = value[2]; + mode = value[1] & 0x7; + index = value[1] >> 3; + if (mode == 0) { + value = VarintUtil.DecodeVarInt32(data, pos, rawSize); + if (value[0] == 0) { + throw new LogException("InitLogGroupsError", "decode varint32 error", requestId, statusCode); + } + pos = value[2]; + } else if (mode == 1) { + pos += 8; + } else if (mode == 2) { + value = VarintUtil.DecodeVarInt32(data, pos, rawSize); + if (value[0] == 0) { + throw new LogException("InitLogGroupsError", "decode varint32 error", requestId, statusCode); + } + if (index == 1) { + logGroups.add(new FastLogGroup(data, value[2], value[1], requestId)); + } + pos = value[1] + value[2]; + } else if (mode == 5) { + pos += 4; + } else { + throw new LogException("InitLogGroupsError", "mode: " + mode, requestId, statusCode); + } + } + if (pos != rawSize) { + throw new LogException("InitLogGroupsError", "parse LogGroupList fail", requestId, statusCode); + } + } + } +} diff --git a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PullLogsRequest.java b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PullLogsRequest.java new file mode 100644 index 00000000..b89ada94 --- /dev/null +++ b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PullLogsRequest.java @@ -0,0 +1,55 @@ +package com.aliyun.gateway.sls.util.model; + + +import com.aliyun.tea.utils.StringUtils; + +public class PullLogsRequest { + private String cursor; + private String endCursor; + private int count; + private String query; + + // GET /logstores/{logStore}/shards/{shardId}?type=log&cursor={cursor}&endCursor={endCursor}&count=${count}&query={query} + public PullLogsRequest(String cursor, String endCursor, int count, String query) { + this.cursor = cursor; + this.endCursor = endCursor; + this.count = count; + this.query = query; + if (StringUtils.isEmpty(cursor)) { + throw new LogException("InvalidParameter", "The specified parameter cursor is missing.", ""); + } + } + + public String getCursor() { + return cursor; + } + + public void setCursor(String cursor) { + this.cursor = cursor; + } + + public String getEndCursor() { + return endCursor; + } + + public void setEndCursor(String endCursor) { + this.endCursor = endCursor; + } + + public int getCount() { + return count; + } + + public void setCount(int count) { + this.count = count; + } + + public String getQuery() { + return query; + } + + public void setQuery(String query) { + this.query = query; + } + +} diff --git a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PullLogsResponse.java b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PullLogsResponse.java new file mode 100644 index 00000000..cb519f95 --- /dev/null +++ b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PullLogsResponse.java @@ -0,0 +1,42 @@ +package com.aliyun.gateway.sls.util.model; + +import com.aliyun.tea.NameInMap; +import com.aliyun.tea.TeaModel; + +public class PullLogsResponse extends TeaModel { + @NameInMap("headers") + public java.util.Map headers; + + @NameInMap("statusCode") + public Integer statusCode; + + @NameInMap("body") + public PostLogStoreLogsResponse.PullLogsResponseBody body; + + public PostLogStoreLogsResponse.PullLogsResponseBody getBody() { + return body; + } + public void setBody(PostLogStoreLogsResponse.PullLogsResponseBody body) { + this.body = body; + } + public static PullLogsResponse build(java.util.Map map) throws Exception { + PullLogsResponse self = new PullLogsResponse(); + return TeaModel.build(map, self); + } + + public PullLogsResponse setHeaders(java.util.Map headers) { + this.headers = headers; + return this; + } + public java.util.Map getHeaders() { + return this.headers; + } + + public PullLogsResponse setStatusCode(Integer statusCode) { + this.statusCode = statusCode; + return this; + } + public Integer getStatusCode() { + return this.statusCode; + } +} diff --git a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PullLogsResponseBody.java b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PullLogsResponseBody.java deleted file mode 100644 index c1aa385a..00000000 --- a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PullLogsResponseBody.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.aliyun.gateway.sls.util.model; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -public class PullLogsResponseBody implements Serializable { - private static final long serialVersionUID = -2027711570684362279L; - // init fields - private final byte[] rawData; - private final Map headers; - private final int statusCode; - // parsed fields - private List logGroups; - private int count; - private String requestId; - private long cursorTime; - private boolean isEndOfCursor; - - public PullLogsResponseBody(byte[] rawData, int statusCode, Map headers) { - this.rawData = rawData; - this.statusCode = statusCode; - this.headers = headers; - parseHeaders(); - } - - public List getLogGroups() throws LogException { - if (logGroups == null) { - parseFastLogGroupList(rawData); - } - return logGroups; - } - - /** - * Get number of logGroups - * - * @return number of logGroups fetched - */ - public int getCount() { - return count; - } - - public long getCursorTime() { - return cursorTime; - } - - public boolean isEndOfCursor() { - return isEndOfCursor; - } - - private void parseHeaders() { - requestId = headers.get("x-request-id"); - isEndOfCursor = "1".equals(headers.get("x-log-end-of-cursor")); - try { - count = Integer.parseInt(headers.get("x-log-count")); - String cursorTimeHeader = headers.get("x-log-cursor-time"); - cursorTime = cursorTimeHeader != null && !cursorTimeHeader.isEmpty() ? Long.parseLong(cursorTimeHeader.trim()) : 0; - } catch (NumberFormatException e) { - throw new LogException("ParsePullLogHeaderError", e.getMessage(), requestId); - } - } - - /** - * Parse LogGroupList using fast deserialize method. - * - * @param data is LogGroupList bytes - * @throws LogException if parse fails - */ - private void parseFastLogGroupList(byte[] data) throws LogException { - logGroups = new ArrayList<>(); - if (data == null || data.length == 0) { - return; - } - int pos = 0; - int rawSize = data.length; - int mode, index; - while (pos < rawSize) { - int[] value = VarintUtil.DecodeVarInt32(data, pos, rawSize); - if (value[0] == 0) { - throw new LogException("InitLogGroupsError", "decode varint32 error", requestId, statusCode); - } - pos = value[2]; - mode = value[1] & 0x7; - index = value[1] >> 3; - if (mode == 0) { - value = VarintUtil.DecodeVarInt32(data, pos, rawSize); - if (value[0] == 0) { - throw new LogException("InitLogGroupsError", "decode varint32 error", requestId, statusCode); - } - pos = value[2]; - } else if (mode == 1) { - pos += 8; - } else if (mode == 2) { - value = VarintUtil.DecodeVarInt32(data, pos, rawSize); - if (value[0] == 0) { - throw new LogException("InitLogGroupsError", "decode varint32 error", requestId, statusCode); - } - if (index == 1) { - logGroups.add(new FastLogGroup(data, value[2], value[1], requestId)); - } - pos = value[1] + value[2]; - } else if (mode == 5) { - pos += 4; - } else { - throw new LogException("InitLogGroupsError", "mode: " + mode, requestId, statusCode); - } - } - if (pos != rawSize) { - throw new LogException("InitLogGroupsError", "parse LogGroupList fail", requestId, statusCode); - } - } -} From 9b28db2dabe43f17abbe5dc546592d248b977aca Mon Sep 17 00:00:00 2001 From: "shuizhao.gh" Date: Tue, 27 Aug 2024 16:53:44 +0800 Subject: [PATCH 4/4] feat: set method return this --- .../sls/util/model/PostLogStoreLogsRequest.java | 15 ++++++++++----- .../gateway/sls/util/model/PullLogsRequest.java | 12 ++++++++---- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PostLogStoreLogsRequest.java b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PostLogStoreLogsRequest.java index 9c24e775..95074638 100644 --- a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PostLogStoreLogsRequest.java +++ b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PostLogStoreLogsRequest.java @@ -65,8 +65,9 @@ public String getCompressType() { return compressType; } - public void setCompressType(String compressType) { + public PostLogStoreLogsRequest setCompressType(String compressType) { this.compressType = compressType; + return this; } /** @@ -83,8 +84,9 @@ public String getTopic() { * * @param topic topic value */ - public void setTopic(String topic) { + public PostLogStoreLogsRequest setTopic(String topic) { this.topic = topic; + return this; } /** @@ -101,8 +103,9 @@ public String getSource() { * * @param source log source */ - public void setSource(String source) { + public PostLogStoreLogsRequest setSource(String source) { this.source = source; + return this; } /** @@ -128,11 +131,13 @@ public List getTags() { * * @param logItems log data */ - public void setLogItems(List logItems) { + public PostLogStoreLogsRequest setLogItems(List logItems) { this.logItems = logItems; + return this; } - public void setTags(List tags) { + public PostLogStoreLogsRequest setTags(List tags) { this.tags = tags; + return this; } } diff --git a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PullLogsRequest.java b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PullLogsRequest.java index b89ada94..f03c9fa5 100644 --- a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PullLogsRequest.java +++ b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/model/PullLogsRequest.java @@ -24,32 +24,36 @@ public String getCursor() { return cursor; } - public void setCursor(String cursor) { + public PullLogsRequest setCursor(String cursor) { this.cursor = cursor; + return this; } public String getEndCursor() { return endCursor; } - public void setEndCursor(String endCursor) { + public PullLogsRequest setEndCursor(String endCursor) { this.endCursor = endCursor; + return this; } public int getCount() { return count; } - public void setCount(int count) { + public PullLogsRequest setCount(int count) { this.count = count; + return this; } public String getQuery() { return query; } - public void setQuery(String query) { + public PullLogsRequest setQuery(String query) { this.query = query; + return this; } }